summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/src/math/i386/sqrtf.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc-top-half/musl/src/math/i386/sqrtf.c')
-rw-r--r--libc-top-half/musl/src/math/i386/sqrtf.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/math/i386/sqrtf.c b/libc-top-half/musl/src/math/i386/sqrtf.c
new file mode 100644
index 0000000..41c65c2
--- /dev/null
+++ b/libc-top-half/musl/src/math/i386/sqrtf.c
@@ -0,0 +1,12 @@
+#include <math.h>
+
+float sqrtf(float x)
+{
+ long double t;
+ /* The long double result has sufficient precision so that
+ * second rounding to float still keeps the returned value
+ * correctly rounded, see Pierre Roux, "Innocuous Double
+ * Rounding of Basic Arithmetic Operations". */
+ __asm__ ("fsqrt" : "=t"(t) : "0"(x));
+ return (float)t;
+}