[PATCH] libm/math: Use __math_xflow in obsolete math code

Corinna Vinschen vinschen@redhat.com
Mon Aug 3 11:32:48 GMT 2020


On Aug  3 10:21, Szabolcs Nagy wrote:
> The 08/01/2020 15:40, Keith Packard wrote:
> > You're right -- here's an updated patch which uses (s < 0) as that
> > doesn't require an extra constant.
> > 
> 
> v2 looks good.
> 
> 
> > From 259c26b2a6697a813d5cd41923079eb873321b3b Mon Sep 17 00:00:00 2001
> > From: Keith Packard <keithp@keithp.com>
> > Date: Thu, 30 Jul 2020 16:41:05 -0700
> > Subject: [PATCH] libm/math: Use __math_xflow in obsolete math code [v2]
> > 
> > C compilers may fold const values at compile time, so expressions
> > which try to elicit underflow/overflow by performing simple
> > arithemetic on suitable values will not generate the required
> > exceptions.
> > 
> > Work around this by replacing code which does these arithmetic
> > operations with calls to the existing __math_xflow functions that are
> > designed to do this correctly.
> > 
> > Signed-off-by: Keith Packard <keithp@keithp.com>
> > 
> > ----
> > 
> > v2:
> > 	libm/math: Pass sign to __math_xflow instead of muliplying result
> > ---
> >  newlib/libm/common/math_errf.c |  2 +-
> >  newlib/libm/math/e_cosh.c      |  9 +++++----
> >  newlib/libm/math/e_exp.c       |  5 +++--
> >  newlib/libm/math/e_pow.c       | 18 ++++++++----------
> >  newlib/libm/math/ef_cosh.c     |  7 ++++---
> >  newlib/libm/math/ef_exp.c      |  5 +++--
> >  newlib/libm/math/ef_pow.c      | 14 ++++++--------
> >  newlib/libm/math/s_erf.c       |  3 ++-
> >  newlib/libm/math/sf_erf.c      |  3 ++-
> >  9 files changed, 34 insertions(+), 32 deletions(-)

Pushed.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat



More information about the Newlib mailing list