FWIW, SBCL's bignum-to-float conversion agrees with Factor's 1 /f (now that I've fixed rounding), and not bignum>float:
* (setq *print-base* 16) 10 * (ieee-floats:encode-float64 (coerce 60179602826890858042495329276589127743 'double-float)) 47C6A315BFB1E4BF ( scratchpad ) 60179602826890858042495329276589127743 1 /f double>bits .h 47c6a315bfb1e4bf ( scratchpad ) 60179602826890858042495329276589127743 >float double>bits .h 47c6a315bfb1e4c0 Slava On Sat, Nov 13, 2010 at 4:05 PM, Slava Pestov <[email protected]> wrote: > Hi Joe, > > Thanks for the bug report. I've pushed fixes for both issues. > > However there are still cases where 1 /f and >float give different results, eg > > ( scratchpad ) 60179602826890858042495329276589127743 [ 1 /f .h ] [ >>float .h ] bi > 1.6a315bfb1e4bfp125 > 1.6a315bfb1e4cp125 > > Which result is more accurate? > > ( scratchpad ) 60179602826890858042495329276589127743 [ dup 1 /f >>integer - . ] [ dup >float >integer - . ] bi > 4414195228865875032127 > -5030537736873415395265 > > Perhaps we could get rid of the bignum>float primitive and redefine it > as 1 bignum/f ? > > Slava > > On Fri, Nov 12, 2010 at 6:59 AM, Joe Groff <[email protected]> wrote: >> A couple quick bugs in bignum-to-float division I found: >> >> - bignum/f rounds toward zero, when it should respect the floating point >> rounding mode, or at least round to nearest. An easy test case is to divide >> a bignum with more than 53 significant bits by 1: >> >> ( scratchpad ) HEX: 7f,ffff,ffff,ffff >bignum [ >float .h ] [ 1 /f .h ] bi >> 1.0p55 >> 1.fffffffffffffp54 >> ( scratchpad ) HEX: -7f,ffff,ffff,ffff >bignum [ >float .h ] [ 1 /f .h ] bi >> -1.0p55 >> -1.fffffffffffffp54 >> >> For both of the above inputs, the first line is from >float, which correctly >> rounds to the nearest floating-point number, and the second is from 1 /f, >> which rounds toward zero. >> >> - Dividing bignum zero by zero gives 0.0, when it should give NAN: >> >> ( scratchpad ) 0 0 /f . >> NAN: 8000000000000 >> ( scratchpad ) 0 >bignum 0 /f . >> 0.0 >> >> -Joe >> ------------------------------------------------------------------------------ >> Centralized Desktop Delivery: Dell and VMware Reference Architecture >> Simplifying enterprise desktop deployment and management using >> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end >> client virtualization framework. Read more! >> http://p.sf.net/sfu/dell-eql-dev2dev >> _______________________________________________ >> Factor-talk mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/factor-talk >> > ------------------------------------------------------------------------------ Centralized Desktop Delivery: Dell and VMware Reference Architecture Simplifying enterprise desktop deployment and management using Dell EqualLogic storage and VMware View: A highly scalable, end-to-end client virtualization framework. Read more! http://p.sf.net/sfu/dell-eql-dev2dev _______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
