~jojo/Carth

8ea6ddf5de7a3e9deafa97b8e524311f26d395d4 — JoJo 2 years ago 9fa98ec
std: make abs & sign work for all numeric types
1 files changed, 2 insertions(+), 2 deletions(-)

M std/math.carth
M std/math.carth => std/math.carth +2 -2
@@ 68,5 68,5 @@
(defun bit-not [n]
  (- (- (cast 0) n) (cast 1)))

(defun abs [x] (if (> x 0) x (neg x)))
(defun sign [x] (if (> x 0) 1 -1))
(defun abs [x] (if (> x (cast 0)) x (neg x)))
(defun sign [x] (if (> x (cast 0)) 1 -1))