[ic] Screwey Math
Russell Mann
tech at khouse.org
Thu Nov 11 18:46:06 EST 2004
Hello,
IC 5.2, Fedora Core 1, Perl 5.8.4 built w/o threads.
Any idea why IC thinks
86.85 - 86.85 = 1.4210854715202e-14
And
46.9 - 46.9 = 7.105427357601e-15
This is a new feature, not sure why it started. My code is for determining
when to tell someone they have a discount:
($totalretail is loaded with the total retail prices of the cart)
[tmp discount_amount][calc]$totalretail-[subtotal
noformat=1][/calc][/tmp]
[if scratch discount_amount > 0]
[calc]$totalretail[/calc] - [subtotal noformat=1] = [scratch
discount_amount]
[/if]
The output of the above code, depending on what is in the cart of course is
this:
86.85 - 86.85 = 1.4210854715202e-14
And
46.9 - 46.9 = 7.105427357601e-15
Ok, so technically 0.000000000000007105427357601 is greater than zero, but
also, technically, 46.9 minus 46.9 is not greater than zero.
Any ideas why my IC has lots its freakin mind?
Russell Mann
More information about the interchange-users
mailing list