#66909 - 2002-06-14 12:54 AM
Re: Ohms Law - Math routine
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Aha! But of course a bare number is... an integer.
So, $x=25 will result in $x being an integer, because the type of the expression "25" is an integer type.
$x=25.0 will result in $x being a double, because the expression "25.0" is a double type.
In the code
code:
$a=25 $b=2 $c=$a/$b
Will result in "12", because the variables $a and $b are both integer, so the math expression is integer. The code
code:
$a=25.0 $b=2.0 $c=$a/$b
Will result in "12.5" because $a and $b are both doubles, and the result of the math expression is a double.
Nice try, but no cigar ![[Wink]](images/icons/wink.gif) [ 13 June 2002, 12:58: Message edited by: Richard Howarth ]
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1471 anonymous users online.
|
|
|