DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9059>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9059

Results of calculations on floating numbers are rounded to 6 decimal digits

           Summary: Results of calculations on floating numbers are rounded
                    to 6 decimal digits
           Product: XalanC
           Version: 1.3.x
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: XalanC
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


With Xalan C 1.3 (I don't know if it's true before), calculations (including 
simple additions) on floating numbers are rounded to 6 decimal digits, even if 
one of the operands has more than 6 decimal digits.

After having looked at the source files, I think the problem could be located in  
the file ./PlatformSupport/DOMStringHelper.cpp and the function XalanDOMString& 
DoubleToDOMString(double theDouble, XalanDOMString& theResult) at the sentence 
(line 1506 of 1750):

unsigned int theCharsWritten = sprintf(theBuffer, "%f", theDouble);

Applying such a format to a double indeed rounds it to 6 decimal digits, at 
least on solaris and linux (and, I bet, with a number of other compilers, as it 
should be the behavior of the ansi C printf() function).

I don't have a clear idea of what to do, but in my opinion, this should be 
improved.

Note: we don't have this problem with Xalan J.

Reply via email to