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

"double floor(double)"



Dear Sirs.

Thank you for the hints I received on my little problem (see below)
posted recently. The main outcome is as follows: the only machine where 
it actually occurred was the one where I've found it: faure.debian.org. 
On lully.debian.org, which has quite the same libraries and compiler installed, 
it did not occur. On the machines of those who kindly supported me, the problem 
did not occur either. So for myself, I will just ignore this problem.

If there is somebody who (for whatever reasons) is still interested or believes
I wanted to fool him: I have left the test program in /tmp/ftest.c (source) and
/tmp/ftest (executable) on faure.debian.org. .. 

Thanks again for your assistance,

Thomas Moor                   


******* c-source code, test.c:

#include <math.h>
#include <stdio.h>

int main(int argc,char** argv){
  long  i;
  double a;
  i=(long)(floor(.3));                     /* i should become 0*/
  a=(double)i;                                /* a should become  0.0 */
  printf("i=%d; a=%f;\n",i,a);    /* prints out funny number for a */
  exit(0);
}


******* compiled by:
$ gcc --ansi test.c -lm

******* executed:
$ ./a.out


******** observed output:
i=0; a=36028797018963968.000000;

******** version of gcc used:
$ gcc -v
Reading specs from /usr/lib/gcc-lib/alpha-linux/2.95.2/specs
gcc version 2.95.2 20000313 (Debian GNU/Linux)

******** librarays used when a.out was executed:
$ ldd a.out
 libm.so.6.1 => /lib/libm.so.6.1 (0x000002000011e000)
 libc.so.6.1 => /lib/libc.so.6.1 (0x0000020000258000)
 /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x0000020000000000)



Reply to: