[ic] Screwey Math

Andrew Shelansky andrew at lunsfordgroup.com
Fri Nov 12 14:55:42 EST 2004

On Thu, 11 Nov 2004, Russell Mann wrote:
> 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:

We encountered the same problem when trying to determine if a collection
of discounts made the order free (and to prevent better-than-free

Ultimately we decided to check to see whether we were less than $0.005. 
We figured any irder total lower than that would be free.

A similar idea should work for you unless you are selling products that
cost less than that -- although look at your numbers, you could use
$0.00005 and be just fine, probably.

-- Andrew

More information about the interchange-users mailing list