On Saturday, July 14, 2001, at 11:17 AM, [EMAIL PROTECTED] wrote:

> In <[EMAIL PROTECTED]>, on 07/14/2001
>    at 11:09 AM, [EMAIL PROTECTED] said:
>
>> So I have stumbled across a linux emulation bug in freebsd.  Below is
>> the program that returns different results based on FreeBSD, Linux or
>> Linux emulation under FreeBSD.
>
>> Running natively under FreeBSD:
>
>> x = 53.27850000
>> exp(x) = 137581029243568449912832.00000000
>
>> Running natively under Linux:
>
>> x = 53.278500
>> exp(x) = 137581029243568449912832.000000
>
>> Running under FreeBSD in Linux emulation mode:
>
>> x = 53.27850000
>> exp(x) = 137581029243567812378624.00000000
>
>
>> #include <stdio.h>
>> #include <math.h>
>> #include <stdlib.h>
>
>> int main (int argc, char **argv) {
>>     double x = 53.278500;
>
>>     printf ("x = %8lf\n", x);
>>     printf ("exp(x) = %8lf\n", exp(x));
>
>>     exit (0);
>> }
>
>> There are only two shared libaries in common (libc and libm) and both
>> are the same on FreeBSD (in /compat/linux) and Linux.
>
>> So any ideas on where the program is going wrong?
>
>> - JimP
>
> My guess is difference between Linux emulation and "native" 's floating
> point formatting for printf.  With the number of significant digits
> you're invoking, small differences in handling low order bits can be
> significant.

So I tried writing it out with write directly and did a binary compare, 
they
still are different.  :(

- JimP

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to