Mail Archives: djgpp/2001/07/11/01:28:32
On Tue, 10 Jul 2001, Patrick Mitran wrote:
> The program I'm writting should eventually run on unix/Linux boxes (for
> my personal use only) so using the erfc() is not going to make my code
> portatble.
??? AFAIK, erfc is available on most modern systems, including Unix and
GNU/Linux systems. You need to link with -lm, but that's all.
So why did you think erfc makes your code non-portable?
> 2. erfc calls ___ieee574_exp() which as far as I can tell is an
> exponential function also implemented as a polynomial curve fit.
>
> The last point raised an eyebrow. Why a curve fit when intel FPUs can
> do exponentiation?
libm which we use was written to be portable to many platforms, so it
doesn't use Intel-specific instructions at all. That's why we have an
alternative implementation for the more popular math functions inside
libc.a, which does use x87 instructions. However, erfc is not one of
those alternative functions.
> Also, I tried compiling a trivial file that just computed sin(2.0) with no
> #include "math" or -lm and it worked! Not only that, but when I
> disassembled it with gdb, the _sin function wasn't the one in libm, it
> actually used the fsin instruction! I'm pretty sure that on a Sun
> machine with gcc this would not have compiled.
>
> What's going on here?
sin _is_ in libc.a and in libm.a.
- Raw text -