Re: power() (to Rob)
- Posted by Robert Craig <rds at RapidEuphoria.com> Jun 05, 2002
- 417 views
Rolf Schroeder writes: > But now I'm convinced that the > function power(), which probably relies on the C function pow(), is not > correctly implemented into Euphoria. I compared pow() (Quick C) and > power() (Euphoria) by the following examples: > ... > Could it be that the WATCOM C behaves different in comparison > to (good old) Quick C ? Your examples work fine with Euphoria on Windows, Linux and FreeBSD. They also work fine with WATCOM C on DOS, provided the /fpc (floating-point calls) option is not used. Euphoria for DOS is built using WATCOM's /fpc option. It allows Euphoria programs to run on old 486's and 386's that lack floating-point hardware. When /fpc is used, floating-point C routines are called, rather than generating in-line floating-point hardware instructions. The routines in most cases check if f.p. hardware is present and use it, but the results of these routines can vary slightly from the in-line approach. The floating-point registers on Intel CPU's are actually 80 bits wide, not 64 bits. That means there is extra precision in performing a series of calculations, as long as the numbers are kept in the f.p. registers. When a result is stored in memory as a C double (Euphoria atom) it is rounded to 64 bits. So it should be more accurate to do in-line f.p., rather than a series of calls, that can only pass 64 bit intermediate results as arguments to these f.p. routines. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com