Port-alpha archive

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

Re: Bug in libm



> einstein:[~] > gcc -o test test.c
> einstein:[~] > ./test
> 234000000000000000000.000000 -5807672958224171008

> but result is (for me) strange.

Looks reasonable to me.

234000000000000000000 is 0xcaf67003701680000; taking the low 64 bits
gives 0xaf67003701680000, which as a signed 64-bit integer is
-5807672958224171008.  And the lrint() manpage I have says that if the
rounded result is too big to be represented as long, the return value
is undefined; taking the low however-many bits strikes me as perfectly
plausible behaviour.

Unless the strangeness you're talking about is the lack of a trap.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index