projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
first commit of the new libm!
[musl]
/
src
/
math
/
copysign.c
diff --git a/src/math/copysign.c
b/src/math/copysign.c
new file mode 100644
(file)
index 0000000..
038b8b4
--- /dev/null
+++ b/
src/math/copysign.c
@@ -0,0
+1,11
@@
+#include "libm.h"
+
+double copysign(double x, double y) {
+ union dshape ux, uy;
+
+ ux.value = x;
+ uy.value = y;
+ ux.bits &= (uint64_t)-1>>1;
+ ux.bits |= uy.bits & (uint64_t)1<<63;
+ return ux.value;
+}