public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] sim/sh: use fabs instead of abs
@ 2022-10-24 16:05 Andrew Burgess
  0 siblings, 0 replies; only message in thread
From: Andrew Burgess @ 2022-10-24 16:05 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ffa2d048221147bad30dde3cfbcb535a824b203d

commit ffa2d048221147bad30dde3cfbcb535a824b203d
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Wed Oct 19 15:04:14 2022 +0100

    sim/sh: use fabs instead of abs
    
    The sh simulator incorrectly uses integer abs instead of the floating
    point fabs on some floating point values, fixed in this commit.

Diff:
---
 sim/sh/interp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sim/sh/interp.c b/sim/sh/interp.c
index fb92d9f4480..38f3f945a35 100644
--- a/sim/sh/interp.c
+++ b/sim/sh/interp.c
@@ -1401,7 +1401,7 @@ fsca_s (int in, double (*f) (double))
   lower = result - error;
   frac = frexp (lower, &exp);
   lower = ldexp (ceil (ldexp (frac, 24)), exp - 24);
-  return abs (upper - result) >= abs (lower - result) ? upper : lower;
+  return fabs (upper - result) >= fabs (lower - result) ? upper : lower;
 }
 
 static float

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-24 16:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-24 16:05 [binutils-gdb] sim/sh: use fabs instead of abs Andrew Burgess

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).