Re: asserting the equality of double values

2007-09-17 Thread Kamaraju S Kusumanchi
Kevin Ryde wrote: > "Nelson H. F. Beebe" <[EMAIL PROTECTED]> writes: >> >> Subtracting one produces a significant of all >> 1-bits: 2**53 - 1 = +0x1.fp+52, > > Yes. > >> and that is the >> next-to-largest exactly representable whole number in this arithmetic >> system. Its floor is

Re: asserting the equality of double values

2007-09-17 Thread Kamaraju S Kusumanchi
Stephen Compall wrote: > On Sat, 2007-09-15 at 13:53 -0400, Kamaraju S Kusumanchi wrote: >> 2) The above code uses DBL_MANT_DIG macro. How can I easily find out >> where this macro is defined? Is there any book or reference which discuss >> this kind of macros. For now I did a grep in /usr/include

Re: asserting the equality of double values

2007-09-17 Thread Kevin Ryde
"Nelson H. F. Beebe" <[EMAIL PROTECTED]> writes: > > Subtracting one produces a significant of all > 1-bits: 2**53 - 1 = +0x1.fp+52, Yes. > and that is the > next-to-largest exactly representable whole number in this arithmetic > system. Its floor is identical, so "x == floor()" is

Re: asserting the equality of double values

2007-09-17 Thread Stephen Compall
On Sat, 2007-09-15 at 13:53 -0400, Kamaraju S Kusumanchi wrote: > 2) The above code uses DBL_MANT_DIG macro. How can I easily find out where > this macro is defined? Is there any book or reference which discuss this > kind of macros. For now I did a grep in /usr/include and found that such a > macr

Re: asserting the equality of double values

2007-09-15 Thread Nelson H. F. Beebe
Kamaraju S Kusumanchi asks today: >> ... >> x = ldexp (1.0, DBL_MANT_DIG) - 1.0; >> assert (x == floor (x)); /* should be an integer already */ >> >> here ldexp and floor both return double values. Is it guaranteed that >> asserting the equality of two double values will always wo

asserting the equality of double values

2007-09-15 Thread Kamaraju S Kusumanchi
I was browsing the source code of guile 1.8.2 and have couple of trivial questions. I would be very grateful if you can answer the following questions. 1) In test-suite/standalone/test-round.c (lines 90-96) we have /* 2^DBL_MANT_DIG-1 In the past scm_c_round had incorrectly increm