Skip to content

Commit

Permalink
Regression in divide operator precedence - fixes #19
Browse files Browse the repository at this point in the history
Also add red/green test to reproduce error
  • Loading branch information
rm-hull committed Jun 18, 2016
1 parent a994274 commit de4fd7a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/infix/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
;; binary operators
'or 'and 'bit-or 'bit-xor 'bit-and 'not= '= '>= '> '<= '<
'unsigned-bit-shift-right 'bit-shift-right 'bit-shift-left
'- '+ '/ 'infix.math/divide '* 'Math/pow 'mod
'- '+ '/ 'infix.math.core/divide '* 'Math/pow 'mod

;; unary operators
'not
Expand Down
4 changes: 4 additions & 0 deletions test/infix/macros_tests.clj
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,7 @@
(doseq [t (repeatedly 50 #(rand-int 1000000))]
(is (= (f t) (infix (t >> 5 | t >> 8)))
(str "Incorrect evaluation for t=" t)))))

(deftest check-division-precedence
(let [x 0 y 1]
(is (= 0.0 (infix sin(x ÷ y ** 2))))))

0 comments on commit de4fd7a

Please sign in to comment.