Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed % to use REM instead of MOD (result differs on negative numbers)

  • Loading branch information...
commit b0920d6faabfb7b1324754dab45e95f76f10d84b 1 parent 1494087
@vsedach vsedach authored marijnh committed
Showing with 6 additions and 2 deletions.
  1. +1 −1  inline-op.lisp
  2. +1 −1  operators.lisp
  3. +4 −0 test.js
View
2  inline-op.lisp
@@ -61,7 +61,7 @@
(if (zerop ,val) (- 0d0) (js- 0 ,val)))))
(defnumop :* `(* ,lhs ,rhs))
-(defnumop :% `(mod ,lhs ,rhs))
+(defnumop :% `(rem ,lhs ,rhs))
(defnumop :< `(< ,lhs ,rhs))
(defnumop :> `(> ,lhs ,rhs))
View
2  operators.lisp
@@ -74,7 +74,7 @@
(if (zerop rs)
(nan)
(complicated-numeric-op
- ls rs mod (nan)
+ ls rs rem (nan)
(nan) (nan) (nan) (nan) ls ls (nan) (nan)))))
(defun js^ (ls rs)
View
4 test.js
@@ -549,6 +549,10 @@ function test_40() {
}
}
+function test_41() {
+ $eq(-12 % 7, -5);
+}
+
function runTests() {
var failures = [];
var run = 0;
Please sign in to comment.
Something went wrong with that request. Please try again.