Date: Tue, 9 Feb 2021 15:15:29 -0800 From: Steve Kargl <sgk@troutmask.apl.washington.edu> To: Dimitry Andric <dim@freebsd.org> Cc: FreeBSD Current <freebsd-current@freebsd.org> Subject: [PACTH,libm] hypothl(x) mishandles subnormal numbers. Message-ID: <20210209231529.GA59891@troutmask.apl.washington.edu> In-Reply-To: <C5652F7E-A943-42AA-A70B-1D4C1C763E06@FreeBSD.org> References: <20210206203929.GA45801@troutmask.apl.washington.edu> <20210206210448.GC45801@troutmask.apl.washington.edu> <C5652F7E-A943-42AA-A70B-1D4C1C763E06@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Feb 06, 2021 at 10:32:33PM +0100, Dimitry Andric wrote: > On 6 Feb 2021, at 22:04, Steve Kargl <sgk@troutmask.apl.washington.edu> wrote: > > > > On Sat, Feb 06, 2021 at 12:39:29PM -0800, Steve Kargl wrote: > >> I've long forgotten by freebsd bugzilla password. > >> So, if someone would like to submit a bug report, > >> here's a test program. > >> > > Forgot to include that issue was identified from > > a bug report in the OpenLibm bug mailing list. > > > > https://github.com/JuliaMath/openlibm/issues/224 > > I put this in <https://bugs.freebsd.org/253313>. Now the trick is to > figure out what is going on in e_hypotl.c... :) > This patch fixes the issue. t1 is used to scale the subnormal numbers. It is generated by scaling the exponent, but that only works if t1 is 1 not 0. Index: src/e_hypotl.c =================================================================== --- src/e_hypotl.c (revision 2342) +++ src/e_hypotl.c (working copy) @@ -82,7 +82,7 @@ hypotl(long double x, long double y) man_t manh, manl; GET_LDBL_MAN(manh,manl,b); if((manh|manl)==0) return a; - t1=0; + t1=1; SET_HIGH_WORD(t1,ESW(MAX_EXP-2)); /* t1=2^(MAX_EXP-2) */ b *= t1; a *= t1; -- Steve
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210209231529.GA59891>