From 416bc450609d4845ee47a79342f4af99b0bf7036 Mon Sep 17 00:00:00 2001 From: Danny Smith Date: Sun, 1 Feb 2004 00:10:17 +0000 Subject: [PATCH] * mingwex/math/powl.c (powl): Return infinity if extended precision multiplication of x by log2(y) overflows. --- winsup/mingw/ChangeLog | 6 ++++++ winsup/mingw/mingwex/math/powl.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index ba08d33d7..f32087fac 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,9 @@ +2004-02-01 Danny Smith + + * mingwex/math/powl.c (powl): Return infinity if + extended precision multiplication of x by log2(y) + overflows. + 2004-01-31 Danny Smith * mingwex/math/cephes_emath.h (__enan_64): Fix thinko. diff --git a/winsup/mingw/mingwex/math/powl.c b/winsup/mingw/mingwex/math/powl.c index 2a09ae1e0..19910bd66 100644 --- a/winsup/mingw/mingwex/math/powl.c +++ b/winsup/mingw/mingwex/math/powl.c @@ -690,6 +690,14 @@ Fa = reducl(F); Fb = F - Fa; G = Fa + w * ya; +if (isinf (G)) + { + /* Bail out: G - reducl(G) will result in NAN + that will propagate through rest of calculations */ + _SET_ERRNO (ERANGE); + mtherr( fname, OVERFLOW ); + return( MAXNUML ); + } Ga = reducl(G); Gb = G - Ga;