From owner-freebsd-hackers Mon Jul 16 23:15:38 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from saturn.cs.uml.edu (saturn.cs.uml.edu [129.63.8.2]) by hub.freebsd.org (Postfix) with ESMTP id 675B537B406 for ; Mon, 16 Jul 2001 23:15:31 -0700 (PDT) (envelope-from acahalan@saturn.cs.uml.edu) Received: (from acahalan@localhost) by saturn.cs.uml.edu (8.11.0/8.11.2) id f6H6FU5376195; Tue, 17 Jul 2001 02:15:30 -0400 (EDT) Date: Tue, 17 Jul 2001 02:15:30 -0400 (EDT) Message-Id: <200107170615.f6H6FU5376195@saturn.cs.uml.edu> From: "Albert D. Cahalan" 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) Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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