Bug 5007 - (hpd) print 1.0 -format x -> 0x1p0 ; i.e., float but in base hex
Summary: (hpd) print 1.0 -format x -> 0x1p0 ; i.e., float but in base hex
Status: RESOLVED FIXED
Alias: None
Product: frysk
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on: 5361
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-07 14:40 UTC by Andrew Cagney
Modified: 2008-01-24 19:30 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Cagney 2007-09-07 14:40:16 UTC
There's a pre-cursor to this - code to unpack and perform arbitrary floating-point.

There's also subtle problems in attempting up conversion such as float->double
alter the value:

  print 1.4
  $1 = 1.3999999999999999

vs:

  print 1.4
  1.4

someone into hard-core floating-point isn't going to accept the former.
Comment 1 Andrew Cagney 2008-01-22 21:43:35 UTC
See printf(3)'s "a" and "A" formats for a guidelines.
Comment 2 Teresa Thomas 2008-01-24 19:30:36 UTC
Eg:
    (fhpd) print 2.0 -format x
    0x1.0p1  

Commit:
    Format floating points as hex constants for '-format x'.
    
    frysk-core/frysk/value/ChangeLog
    2008-01-24  Teresa Thomas  <tthomas@redhat.com>
    
    	* FloatingPointType.java (printAsHexConstant): New.
    	* Format.java (printHexadecimalFP): Call printAsHexConstant.
    	* TestFormat.java (testHexadecimal): Update values.