Forum archive 2000-2006

Mark Schmitt - Error in floor for 1.7

Mark Schmitt - Error in floor for 1.7

by Arnold Pizer -
Number of replies: 0
inactiveTopicError in floor for 1.7 topic started 10/21/2002; 1:40:47 AM
last post 10/21/2002; 7:56:06 AM
userMark Schmitt - Error in floor for 1.7  blueArrow
10/21/2002; 1:40:47 AM (reads: 803, responses: 1)
I don't know if this has been fixed in 1.8, but I just noticed an error in the floor function in 1.7.

Current code: $out = int $input; $out -- if ($out <=0 and $out-$input);

This doesn't work for -1<$input<1, unless $input = 0. The reason is that $out-$input returns true unless $out = $input. (Any non-zero value is true). I replaced the second line above with: $out -- if ($out <=0 and ($out-$input)>0); This seems to take care of the problem.

Mark

<| Post or View Comments |>


userArnold K. Pizer - Re: Error in floor for 1.7  blueArrow
10/21/2002; 7:56:06 AM (reads: 1023, responses: 0)
Thanks Mark,

This bug was not fixed in 1.8.00. It's now fixed in the CVS and will be fixed in 1.8.01 if a 1.8.01 release is deemed necessary.

Arnie

<| Post or View Comments |>