[prev in list] [next in list] [prev in thread] [next in thread]
List: xalan-j-users
Subject: Issue with double in FuncSum
From: Bhuvan Mohan <bhuvan.mohan () in ! fiorano ! com>
Date: 2014-11-28 10:42:09
Message-ID: 54784EB1.7020001 () in ! fiorano ! com
[Download RAW message or body]
Hi Everyone,
We are using xalan 2.7.0 in our product. I recently faced an issue which
I found exists in Java Double.
In nodeset summation using double the output is not precise
Ref:
http://stackoverflow.com/questions/5257166/java-floats-and-doubles-how-to-avoid-that-0-0-0-1-0-1-0-9000001
In class org.apache.xpath.functions.FuncSum#execute, double is being
used. It all works perfectly fine but when I debugged the source I found
the problem occurs after summation is done in the line after returning
from toDouble() in
sum += s.toDouble();
when I did a test on a seperate Java sample I faced a similar result. It
appears that using BigInteger could help resolve the problem.
Thanks & Regards,
Bhuvan Rawal
[Attachment #3 (text/html)]
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Everyone,<br>
<br>
We are using xalan 2.7.0 in our product. I recently faced an issue
which I found exists in Java Double.<br>
In nodeset summation using double the output is not precise <br>
<br>
Ref:
<a class="moz-txt-link-freetext" \
href="http://stackoverflow.com/questions/5257166/java-floats-and-doubles-how-to-avoid- \
that-0-0-0-1-0-1-0-9000001">http://stackoverflow.com/questions/5257166/java-floats-and-doubles-how-to-avoid-that-0-0-0-1-0-1-0-9000001</a><br>
<br>
In class org.apache.xpath.functions.FuncSum#execute, double is being
used. It all works perfectly fine but when I debugged the source I
found the problem occurs after summation is done in the line after
returning from toDouble() in <br>
<br>
sum += s.toDouble()<span style="color:#cc7832;">;</span><br>
<br>
when I did a test on a seperate Java sample I faced a similar
result. It appears that using BigInteger could help resolve the
problem.<br>
<br>
Thanks & Regards,<br>
Bhuvan Rawal<br>
<br>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</body>
</html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic