![]() |
|
Message-ID: <CACt3ES0BX8sF37C62WDSuQ847LTADkJ6e+vsPpKxoJ_+skVGaA@mail.gmail.com> Date: Wed, 12 Jun 2024 23:38:53 +0800 From: Meng Zhuo <mzh@....io> To: Rich Felker <dalias@...c.org> Cc: musl@...ts.openwall.com Subject: Re: [PATCH v2] math: add riscv64 round/roundf Sorry, I'm not familiar to mail list contribution(first time) and send another wrong patch(v3) for this. I'll fix it. Rich Felker <dalias@...c.org> 于2024年6月12日周三 23:18写道: > > On Wed, Jun 12, 2024 at 11:14:13PM +0800, Meng Zhuo wrote: > > --- > > v1 -> v2: > > * drop ±inf check and use fabs as Rich suggested > > That is not the significant change. The significant change is fixing > completely wrong behavior on large finite inputs. > > > --- > > src/math/riscv64/round.c | 21 +++++++++++++++++++++ > > src/math/riscv64/roundf.c | 21 +++++++++++++++++++++ > > 2 files changed, 42 insertions(+) > > create mode 100644 src/math/riscv64/round.c > > create mode 100644 src/math/riscv64/roundf.c > > > > diff --git a/src/math/riscv64/round.c b/src/math/riscv64/round.c > > new file mode 100644 > > index 00000000..81991b5f > > --- /dev/null > > +++ b/src/math/riscv64/round.c > > @@ -0,0 +1,21 @@ > > +#include <math.h> > > + > > +#if __riscv_flen >= 64 > > + > > +double round(double x) > > +{ > > + if (isnan(x)) return x; > > + if (fabs(x) >= 0x1p54) return x; > > Did you keep the isnan test separate to avoid raising an exception, or > for other reasons? > > Rich >
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.