[ic] Really strange [calc] evaluation
emailgrant at gmail.com
Wed Jan 27 02:44:18 UTC 2010
>> The following should evaluate to zero:
>> [calc]197.7 - (32.95 * 6)[/calc]
>> but instead I get:
>> Everything else is functioning normally. Does anyone know what's
>> going on here? I'm on 5.6.1.
> Standard floating point arithmetic. Same thing occurs in every programming
> language that uses FP. Use rounding (printf) or CPAN modules to handle it.
OK, I'd like to change the code so that it produces the correct
result. I tried:
[calc]sprintf("%.0f",(197.7 - (32.95 * 6)))[/calc]
but I get -0. This situation seems pretty strange to me. How can I
get [calc] to calculate reliably?
More information about the interchange-users