public inbox for newlib-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Fix truncf for sNaN input Date: Wed, 11 Mar 2020 11:11:20 +0000 (GMT) [thread overview] Message-ID: <20200311111120.EC63D385F022@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c56f53a2a04577f6e84ac96477fc8dc804d544ef commit c56f53a2a04577f6e84ac96477fc8dc804d544ef Author: Fabian Schriever <fabian.schriever@gtd-gmbh.de> Date: Wed Mar 11 10:58:05 2020 +0100 Fix truncf for sNaN input Make line 47 in sf_trunc.c reachable. While converting the double precision function trunc to the single precision version truncf an error was introduced into the special case. This special case is meant to catch both NaNs and infinities, however qNaNs and infinities work just fine with the simple return of x (line 51). The only error occurs for sNaNs where the same sNaN is returned and no invalid exception is raised. Diff: --- newlib/libm/common/sf_trunc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newlib/libm/common/sf_trunc.c b/newlib/libm/common/sf_trunc.c index 74ea933ce..8eb0554d8 100644 --- a/newlib/libm/common/sf_trunc.c +++ b/newlib/libm/common/sf_trunc.c @@ -42,7 +42,7 @@ } else { - if (exponent_less_127 == 255) + if (exponent_less_127 == 128) /* x is NaN or infinite. */ return x + x;
reply other threads:[~2020-03-11 11:11 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200311111120.EC63D385F022@sourceware.org \ --to=corinna@sourceware.org \ --cc=newlib-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).