Raymond Toy pushed to branch issue-474-print-parse-hex-floats at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • src/code/ext-code.lisp
    ... ... @@ -30,9 +30,13 @@
    30 30
     (defun float-to-hex-string (val &optional at-p)
    
    31 31
       "Prints a single or double float in bit-perfect C-style hex.
    
    32 32
        If AT-P is true, prepends '+' for non-negative finite values."
    
    33
    -  (cond ((ext:float-nan-p val) "nan")
    
    33
    +  (cond ((ext:float-nan-p val)
    
    34
    +	 "0x0.0p+nan")
    
    34 35
             ((ext:float-infinity-p val) 
    
    35
    -         (if (plusp val) (if at-p "+inf" "inf") "-inf"))
    
    36
    +         (if (plusp val)
    
    37
    +	     (if at-p
    
    38
    +		 "+0x1.0p+inf" "0x1.0p+inf")
    
    39
    +	     "-0x1.0p+inf"))
    
    36 40
             (t
    
    37 41
              (multiple-value-bind (sign exp-bits mantissa bias precision suffix)
    
    38 42
                  (typecase val