This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] Set up errno properly for yn
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 9 May 2012 17:13:16 +0000 (UTC)
- Subject: Re: [PATCH] Set up errno properly for yn
- References: <20120509165829.GJ19535@redhat.com>
On Wed, 9 May 2012, Marek Polacek wrote:
> This is a stab at fixing the bug 6808. The problem is that we weren't
> setting errno to ERANGE when the second argument is DBL_MIN/FLT_MIN.
> I had to use the fetestexcept function, since the FE_OVERFLOW _might_
> be set by the GET_HIGH_WORD(high,b) line in the __ieee754_yn function.
> I don't know whether this is The Right Thing To Do, it might be
> necessary to guard fetestexcept with feholdexcept/feupdateenv, but
> that seem quite expensive :/.
Arbitrary exceptions may be set before the function, and you don't want to
set errno based on a previous exception, only one raised during the
> I've tried also
> if (isfinite (b) != 0)
> __set_errno (ERANGE);
> but that didn't work.
It should work if you fix the sense of the test ... (though for some
reason the usual idiom calls __finite, __finitef, __finitel directly).
I'd expect all versions of this function to need similar changes.
Conditioning the test on TEST_DOUBLE certainly seems wrong.
Joseph S. Myers