problems with ~G in format

Bug #878163 reported by Nikodemus Siivola
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Triaged
Low
Unassigned

Bug Description

Originally reported as: http://article.gmane.org/gmane.lisp.steel-bank.devel/13878

CL-USER> (format nil "~G" most-positive-double-float) ; totally messed up
"179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000. "
CL-USER> (format nil "~G" 0.04165461138601871d0) ; extra zero
"4.16546113860187140d-2"
CL-USER> (format nil "~G" 9.6000000000000474d-2) ; two extra zeros
"9.60000000000004700d-2"

Tags: format review fp
Revision history for this message
Nikodemus Siivola (nikodemus) wrote :
tags: added: review
Revision history for this message
Douglas Katzman (dougk) wrote :

I think most-positive-double-float is NOT totally messed up.
Trying to follow the algorithm verbatim in
http://www.lispworks.com/documentation/HyperSpec/Body/22_ccc.htm
I calculate the ~F parameters that would produce that long string.
The only other option is that in ~F it says "If w is omitted, then if the magnitude of arg is so large ... that more than 100 digits would have to be printed, then an implementation is free, at its discretion, to print the number using exponential notation instead"

At any rate this hardly qualifies as medium priority after 9 years of idleness.

Changed in sbcl:
importance: Medium → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.