Clojure

GC Issue 60: Ratio to floating point conversion miscalculation

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Reported by jbondeson, Jan 30, 2009
Originally discussed here:
http://groups.google.com/group/clojure/browse_thread/thread/1f8029b8556ce851/9b7538b192490097?lnk=gst&q=ratio#9b7538b192490097

The current implementation of conversion of clojure.lang.Ratio class
to a fixed precision floating point value is not what one would expect. 
For example:

user> (double (/ (expt 2 1024) 3))
Infinity
when in fact it should return: 5.992310449541053E307  

Attached is the fix for the Ratio class to allow for the proper conversion
to a double or float by using a BigDecimal division with a fixed precision.

Additionally, I sent in my CA on Monday, so it should be there anytime now.
 ratio-conv.diff
1.0 KB Download
Comment 1 by richhickey, Feb 09, 2009
patch applied - svn 1256 - thanks!
Status: Fixed

Activity

Hide
Assembla Importer added a comment -

cemerick said: [file:ckgKFGw3ur3R14eJe5aVNr]

Show
Assembla Importer added a comment - cemerick said: [file:ckgKFGw3ur3R14eJe5aVNr]
Hide
Assembla Importer added a comment -

oranenj said: Updating tickets (#63, #65, #66, #67, #68, #70, #73, #74, #75, #76, #78, #80, #81, #83, #86, #88, #90, #92, #93, #95, #97, #98)

Show
Assembla Importer added a comment - oranenj said: Updating tickets (#63, #65, #66, #67, #68, #70, #73, #74, #75, #76, #78, #80, #81, #83, #86, #88, #90, #92, #93, #95, #97, #98)

People

  • Assignee:
    Unassigned
    Reporter:
    Anonymous
Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: