Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Jun 2013 21:58:29 -0700
From:      David Schultz <das@FreeBSD.ORG>
To:        Eitan Adler <lists@eitanadler.com>
Cc:        freebsd-numerics@freebsd.org
Subject:   Re: operation precedence bug: lib/msun/src
Message-ID:  <20130628045829.GA3590@zim.MIT.EDU>
In-Reply-To: <CAF6rxg=7AQ-5qnOu0_neZMG-=xQTL5wjM+t_qopeVN4uxg8g5w@mail.gmail.com>
References:  <CAF6rxg=7AQ-5qnOu0_neZMG-=xQTL5wjM+t_qopeVN4uxg8g5w@mail.gmail.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Wed, Jun 19, 2013, Eitan Adler wrote:
> Does the following look correct?
[...]
> diff --git a/lib/msun/src/s_fma.c b/lib/msun/src/s_fma.c
[...]
> -		if (bits_lost != 1 ^ (int)(hibits & 1)) {
> +		if (bits_lost != (1 ^ (int)(hibits & 1))) {

No, logical xor is intended: If we lost one bit due to
denormalization, we need to adjust if the low bit is 1, and if we
lost more than one bit, we need to adjust if the low bit is 0.

I apologize for writing 6 lines of code that would take pages to
explain. The relevant background (guard and sticky bits) is covered
in the following book chapter if you're interested:

    http://uenics.evansville.edu/~mr56/ece752/AppendixH.pdf



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20130628045829.GA3590>