[cfe-dev] Print Double Precision Values

Zheng Wang jason.wangz at gmail.com
Tue Jul 5 04:14:02 PDT 2011


Hi,

The VisitFloatingLiteral in StmtPrint is defined as:

        // FIXME: print value more precisely.
        OS << Node->getValueAsApproximateDouble();


This may result in lost of precision when printing double precision value.
 For example,
"-3.247834652034740e3" will be printed as "-3.247835e+03"

Is there any way to *precisely* print out a double precision value (i.e.,
the same as it appears in the source code)?


Cheers,
Zheng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110705/27520ce1/attachment.html>


More information about the cfe-dev mailing list