chickadee » math » fp2

fp2 x #!optional yprocedure
x
number (or flonum if y passed)
y
flonum

Converts a real number or the sum of two flonums into a double-double.

> (fp 1/7)
0.14285714285714285
> (relative-error (fp 1/7) 1/7)
5.551115123125783e-17
> (define-values (x2 x1) (fp2 1/7))
> (list x2 x1)
(0.14285714285714285 7.93016446160826e-18)
> (fp (relative-error (+ (inexact->exact x2)
                         (inexact->exact x1))
                      1/7))
3.0814879110195774e-33

Notice that the exact sum of x2 and x1 in the preceeding example has very low relative error.

If x is not rational, fp2 returns (values x 0.0).