Hacker News new | ask | show | jobs
by stassats 380 days ago
You can turn them back into rationals, (rational (sqrt 2d0)) => 6369051672525773/4503599627370496

Or write your own operations that compute to the precision you want.

1 comments

My post already covered inexact->exact:

     scheme@(guile-user)> (inexact->exact (sqrt 2.0))
$1 = 6369051672525773/4503599627370496

s9 Scheme fails on this as it's an irrational number, but the rest of Schemes such as STKlos, Guile, Mit Scheme, will do it right.

With Forth (and even EForth if the images it's compiled with FP support), you are on your own to check (or rewrite) an fsqrt function with an arbitrary precision.

Also, on trig, your parent commenter should check what CORDIC was.

https://en.wikipedia.org/wiki/CORDIC