chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] expt incorrect in boundary cases


From: Matthew Flatt
Subject: Re: [Chicken-users] expt incorrect in boundary cases
Date: Tue, 28 Apr 2009 11:32:14 -0600

For what it's worth,

  http://svn.plt-scheme.org/plt/trunk/src/mzscheme/sconfig.h

contains a number of platform-specific, FP-related declarations that
reflect how well different libms work in our experience. For example,
POW_HANDLES_INF_CORRECTLY is declared for NetBSD, but not for Linux.

I doubt that "sconfig.h" is the right way to attack the problem (it
predates the use of autoconf to build PLT Scheme), but the flag
descriptions in the "Inexact Arithmetic" section might give you some
idea of the space of problems we've seen.

At Tue, 28 Apr 2009 19:22:44 +0200 (CEST), fulvio ciriaco wrote:
> No, not a bug with the definition.
> It depends on libm.
> >csi -e "(print (expt 1.0 +inf))" 
> 1.0
> >uname -a
> Linux bellini 2.6.28-ARCH #1 SMP PREEMPT Sun Mar 8 10:18:28 UTC 2009 i686 AMD 
> Athlon(tm) 64 Processor 3200+ AuthenticAMD GNU/Linux
> >ldd chicken/bin/csi
>       linux-gate.so.1 =>  (0xb7f10000)
>       libchicken.so => /home/fc/chicken/lib/libchicken.so (0xb7ca6000)
>       libm.so.6 => /lib/libm.so.6 (0xb7c67000)
>       libdl.so.2 => /lib/libdl.so.2 (0xb7c63000)
>       libc.so.6 => /lib/libc.so.6 (0xb7b1c000)
>       /lib/ld-linux.so.2 (0xb7f11000)
> 
> >csi -e "(print (expt 1.0 +inf))" 
> +nan
> >uname -a
> >ldd chicken/bin/csi
>       -lc.12 => /usr/lib/libc.so.12
>       -lm.0 => /usr/lib/libm.so.0
>       -lchicken => /home/fc/chicken/lib/libchicken.so
> 
> NetBSD  5.0_RC4 NetBSD 5.0_RC4 (GENERIC) #0: Wed Apr 15 12:24:14 UTC 2009  
> address@hidden:/home/builds/ab/netbsd-5-0-RC4/i386/200904142015Z-obj/home
> /builds/ab/netbsd-5-0-RC4/src/sys/arch/i386/compile/GENERIC i386
> 
> Fulvio
> 
> From: John Cowan <address@hidden>
> Subject: [Chicken-users] expt incorrect in boundary cases
> Date: Tue, 28 Apr 2009 11:14:46 -0400
> 
> > According to IEEE 754, the four expressions (expt 1.0 +inf), (expt -1.0 
> +inf),
> > (expt 1.0 -inf), and (expt -1.0 -inf) should all return +nan.  In Chicken 
> they
> > all return 1.0 instead.  This appears to be a bug in the ISO C definition
> > of the "pow" function.  Checking for these four cases and bypassing pow
> > would Do The Right Thing.
> > 
> > I found this when exhaustively checking the boundary cases for abs, acos,
> > asin, atan (1-arg and 2-arg versions), ceiling, cos, exp, expt, floor, log,
> > round, sin, sqrt, and tan.  All the others are correct.
> > 
> > -- 
> > John Cowan        http://ccil.org/~cowan   address@hidden
> > Lope de Vega: "It wonders me I can speak at all.  Some caitiff rogue did
> > rudely yerk me on the knob, wherefrom my wits still wander."
> > An Englishman: "Ay, a filchman to the nab betimes 'll leave a man
> > crank for a spell." --Harry Turtledove, Ruled Britannia
> > 
> > 
> > _______________________________________________
> > Chicken-users mailing list
> > address@hidden
> > http://lists.nongnu.org/mailman/listinfo/chicken-users
> 
> 
> _______________________________________________
> Chicken-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/chicken-users




reply via email to

[Prev in Thread] Current Thread [Next in Thread]