precise double rewrite patch

Hi @clang,

the attached patch increases the precision of the FloatingLiteral rewrite significantly. With the patch sometimes the output is no longer "pretty". However it is always precise. Before the change I had serious trouble with rounding errors.
I hope the proposed approach is considered better than the old one. Of course it might be possible to make it sometimes much prettier while not loosing too much precision but I'm not sure how exactly (what is the definition of "loosing too much precision") and whether it is worth the effort.

Best regards
Olaf Krzikalla

precise_rewrite.patch (657 Bytes)

Your patch prints way too many digits: the second argument of toString
is digits, and semanticsPrecision is in bits. Does Val.toString(Str)
(using the default value for the number of digits to print) not do the
right thing?

Also, you can simplify the code a bit by using SmallString instead of
SmallVector.

-Eli

Yep, this was indeed sufficient. And the output is now much prettier (even prettier than the original version). Also I've simplified the patch as you've advised.

Best regards
Olaf Krzikalla

precise_rewrite.patch (519 Bytes)

r141208.

-Eli