From 3fd275f59facc3f9ea14536f268becf90f7aec81 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Thu, 15 Aug 2024 18:33:40 -0700 Subject: [PATCH] Import optimized routines changes to exp10 --- libc/tinymath/exp10.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libc/tinymath/exp10.c b/libc/tinymath/exp10.c index 443800a66ad..f58f0f3f0e6 100644 --- a/libc/tinymath/exp10.c +++ b/libc/tinymath/exp10.c @@ -43,7 +43,7 @@ special_case (uint64_t sbits, double_t tmp, uint64_t ki) { double_t scale, y; - if (ki - (1ull << 16) < 0x80000000) + if ((ki & 0x80000000) == 0) { /* The exponent of scale might have overflowed by 1. */ sbits -= 1ull << 52; @@ -109,14 +109,14 @@ exp10 (double x) /* Reduce x: z = x * N / log10(2), k = round(z). */ double_t z = __exp_data.invlog10_2N * x; double_t kd; - int64_t ki; + uint64_t ki; #if TOINT_INTRINSICS kd = roundtoint (z); ki = converttoint (z); #else kd = eval_as_double (z + Shift); + ki = asuint64 (kd); kd -= Shift; - ki = kd; #endif /* r = x - k * log10(2), r in [-0.5, 0.5]. */