From: Andrew Burgess Date: Wed, 19 Oct 2022 14:04:14 +0000 (+0100) Subject: sim/sh: use fabs instead of abs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ffa2d048221147bad30dde3cfbcb535a824b203d;p=binutils-gdb.git 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 --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