aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-03-05 17:35:52 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-03-05 17:35:52 -0800
commit87dade0f40b1bdb72019f9f4c2f0647bc61d210d (patch)
tree63b030e05cd0092076cef194fb87faa7df4b6cbb
parent509dc21a4832d3f99e4c4506fa78c223d094127e (diff)
parent1cd99d08893e24f594fa0bd19108225ab3acfa80 (diff)
Merge pull request #922 from waywardmonkeys/implement-signbit
Implement signbit in terms of copysign.
-rw-r--r--src/library.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/library.js b/src/library.js
index 92907c55..a5166c72 100644
--- a/src/library.js
+++ b/src/library.js
@@ -5507,6 +5507,14 @@ LibraryManager.library = {
return -a;
},
copysignf: 'copysign',
+ __signbit__deps: ['copysign'],
+ __signbit: function(x) {
+ // We implement using copysign so that we get support
+ // for negative zero (once copysign supports that).
+ return _copysign(1.0, x) < 0;
+ },
+ __signbitf: '__signbit',
+ __signbitd: '__signbit',
hypot: function(a, b) {
return Math.sqrt(a*a + b*b);
},