[LLVMdev] Floating point constants (bug?)

Dale Johannesen dalej at apple.com
Mon Jul 30 17:28:30 PDT 2007


On Jul 15, 2007, at 5:09 PM, Chris Lattner wrote:

> On Sun, 15 Jul 2007, Ben Chambers wrote:
>> ...
>>  store float 0x4016A3D700000000, float* %f
>> ...
>>
>> Which is correct, but is a pain to have to parse.  Ideally, floating
>> point would be printed like it says in the language guide, only using
>> the hexadecimal representation when decimal representation is
>> impossible.  In this case, however, 5.66e+00 seems pretty reasonable
>
> The code is correct, please don't file a bug.  The number in  
> question is
> 5.6599998474121094, not 5.66, which is the closest approximation to  
> 5.66
> you can get.

Yes.  However, every hex floating point number (barring NaNs and  
infinities)
does have an exact decimal representation, so we could use those  
consistently
if we wanted to.  Thus, 5.659999... as above instead of the original  
5.66.  These
can be thousands of digits long though.





More information about the llvm-dev mailing list