[Ecls-list] ECL now rounds rationals

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Sat Dec 5 00:50:03 UTC 2009


* Visible changes:

 - When converting rationals to floats, ECL now rounds instead of using the
   routine in GMP, which truncates.

(loop for type in '(short-float single-float double-float long-float)
       for i from 60 to 70
       nconc (loop with value = (ash 1 i)
                with expected = (coerce 1 type)
                for j from 0 to 10
                for x = (- value j)
                for r = (/ (1- x) x)
                for f1 = (coerce r type)
                for f2 = (- (coerce (- r) type))
                unless (and (= f1 expected) (= f2 expected))
                collect r))

=> NIL

Before it produced a list of rationals it failed to round.

-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com




More information about the ecl-devel mailing list