

John Fremlin's blog: Dynamic Lisp blog entry demo: rationalize
source link: http://john.freml.in/dynamic-blog-entries
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

John Fremlin's blog: Dynamic Lisp blog entry demo: rationalize
Waiting for updates: connected
Posted 2014-03-13 07:00:00 GMT
Given a floating point number, how to go to its representation as a rational?
1.0471976 = 1/3π
Try another number:
Thanks to the RATIONALIZE function in Common Lisp. See the SBCL source.
Updated to not show d0 at the end
Posted 2014-03-13 08:03:49 GMT by John Fremlin
Thank you for this.
Interestingly, on LispWorks:
CL-USER 1 > (rationalize 1.0471972)
7211/6886
On SBCL,
* (rationalize 1.0471972)
6501/6208
Posted 2020-01-28 14:09:54 GMT by Priyadarshan
Post a comment
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK