[libc-commits] [PATCH] D143098: [libc][math] Fix setting exceptional value for tanf to work with gcc.

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Feb 1 11:27:38 PST 2023


lntue created this revision.
lntue added reviewers: michaelrj, sivachandra.
Herald added subscribers: ecnelises, tschuett.
Herald added projects: libc-project, All.
lntue requested review of this revision.

See https://github.com/llvm/llvm-project/issues/59866


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143098

Files:
  libc/src/math/generic/tanf.cpp


Index: libc/src/math/generic/tanf.cpp
===================================================================
--- libc/src/math/generic/tanf.cpp
+++ libc/src/math/generic/tanf.cpp
@@ -97,7 +97,10 @@
     // |x| = 0x1.143ec4p0
     float sign = x_sign ? -1.0f : 1.0f;
 
-    return fputil::multiply_add(sign, 0x1.ddf9f4p0f, sign * 0x1.1p-24f);
+    volatile float tmp = 0x1.ddf9f4p0f;
+    tmp = fputil::multiply_add(sign, tmp, sign * 0x1.1p-24f);
+
+    return tmp;
   }
 
   // |x| > 0x1.ada6a8p+27f


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143098.494023.patch
Type: text/x-patch
Size: 497 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230201/76d0c808/attachment.bin>


More information about the libc-commits mailing list