Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Jul 2001 02:15:30 -0400 (EDT)
From:      "Albert D. Cahalan" <acahalan@cs.uml.edu>
To:        freebsd-hackers@FreeBSD.ORG
Cc:        Jim.Pirzyk@disney.com, tlambert2@mindspring.com
Subject:   Re: math library difference between linux emulation and native freebsd  (and native linux)
Message-ID:  <200107170615.f6H6FU5376195@saturn.cs.uml.edu>

next in thread | raw e-mail | index | archive | help

Terry Lambert writes:
> Jim.Pirzyk@disney.com wrote:

>> 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?
>
> man fpsetround

That won't change a thing. Both systems round to nearest.

> The defaults for the Linux emulator are different than
> the defaults for Linux.  Linux sets some stuff up wrong,

FreeBSD sets stuff up wrong. This is a choice between bad
and worse, since the CPU does not support what you want.

An x86 CPU has a rounding precision that may be set for
float, double, or long double. FreeBSD sets the CPU to
make double work, giving extra fraction bits for float
and truncating long double. Linux sets the CPU to make
long double work, giving extra fraction bits for both
float and long double. Now what is worse, getting some
extra bits in an intermediate calculation or truncation?
Note that the FreeBSD setting causes _both_ problems.

See float_t, double_t, FLT_EVAL_METHOD and FLT_ROUNDS in
the 1999 C standard for ways to deal with x86 hardware.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200107170615.f6H6FU5376195>