Mail Archives: djgpp/1996/09/30/01:18:03
This is odd. I checked, and found exactly the same problem (fifth call
to ldexp always causes SIGFPE). HOWEVER, if you leave off the "-lm",
and use the non-math library ldexp, no floating-point error occurs.
As the obivous quick-fix, Guillermo, just don't link with libm.a
***Note to whoever is currently maintaining the math libs:
Is this a general bug, or is it possibly related to a particular setup?
Ian
ian AT viemeister DOT com
http://viemeister.com/
Guillermo Ballester Valor wrote:
> There is only a problem. I cannot find the solution. When I use 'ldexp'
> function, defined in math.h, program breaks. On the contrary Borland
> compiler works well. I don't know what's wrong. Below, I have inserted a
> simple p.cpp which produces a runtime error. I have observed that it always
> appears in fifth call to ldexp, whatever be the arguments.
> Compiler Invoke: gxx -g -o p.exe p.cpp -lm
>
> PROGRAM : P.CPP
>
> /* This is a simple program test for ldexp function */
> #include <math.h>
> #include <stdio.h>
> void test(double d, int n)
> {
> double d1=ldexp(d,n);
> printf("\nldexp(%lf , %i ) is %lf",d,n,d1);
> }
>
> main()
> {
> test(1,1);
> test(1,32);
> test(4,16);
> test(16,32);
> test(32,32);
> test(2.5,7);// and so on ... Always breaks in fifth call
> }
>
> I would like to know if I am doing something incorrect. Please help me.
- Raw text -