
HELP HELP HELP - round function error
Quote:
> whent i try to calculate the round of 111.5 for example i get 111 and in
> other situation like 112.5 i get 113..
The 111.5 value is probably closer to 111.4999, so it gets rounded down to
111, but the 112.5 value is greater than or equal to 112.500000, so it gets
rounded up to 113. It is not a bug. It is simply one of the many problems
with using floating point numbers. If you want to see what the actual values
are, use something like the following to display them:
? STR( variable, 30, 20 )
Don't bother trying "? STR( 111.5, 30, 20 )", because Clipper uses an
optimizing compiler and will print " 111.50000000000000000000".
--
David G. Holm