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

Corinna Vinschen via Newlib <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
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 <[email protected]>
> > 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 <[email protected]>
> > 
> > ----
> > 
> > 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.