Subject:Math Error Author:allen watson Date:17 Nov 2005 08:19 PM Originally Posted: 02 Nov 2005 06:32 PM
11641.71 + 489.63 - 12131.34 = -0.00000000000181898940354586<br>
this should be zero. Is there a XSL processor patch? and how soon will the fix be ready?
Here is the workaround:
round(11641.71*100) + round(489.63*100) - round(12131.34*100) = 0
ugly but it worked.
Subject:Math Error Author:Clyde Kessel Date:02 Nov 2005 08:52 PM
Sadly, the XSLT 1.0 spec requires the use of floating point arithmetic (what were they thinking?), and all compliant processors return the same result. I have applied to Lord Krishna for a fix to the laws of mathematics, but haven't heard back yet. There are various functions like round() and xsl:decimal-format() to help a bit. XSLT 2.0, of course, has a decimal data type.