`(progn ,@(mapcar (lambda (def) (cons 'defpsmacro def)) mathdefs)))
(def-js-maths
- (min (&rest nums) `(*math.min ,@nums))
(max (&rest nums) `(*math.max ,@nums))
+ (min (&rest nums) `(*math.min ,@nums))
+ (floor (n &optional divisor) `(*math.floor ,(if divisor `(/ ,n ,divisor) n)))
(ceiling (n &optional divisor) `(*math.ceil ,(if divisor `(/ ,n ,divisor) n)))
- (abs (n) `(*math.abs ,n))
+ (round (n &optional divisor) `(*math.round ,(if divisor `(/ ,n ,divisor) n)))
(sin (n) `(*math.sin ,n))
(cos (n) `(*math.cos ,n))
(tan (n) `(*math.tan ,n))
- (acos (n) `(*math.acos ,n))
(asin (n) `(*math.asin ,n))
+ (acos (n) `(*math.acos ,n))
(atan (y &optional x) (if x `(*math.atan2 ,y ,x) `(*math.atan ,y)))
+ (abs (n) `(*math.abs ,n))
+ (evenp (n) `(not (oddp ,n)))
+ (oddp (n) `(% ,n 2))
(exp (n) `(*math.exp ,n))
+ (expt (base power) `(*math.pow ,base ,power))
(log (n &optional base)
(or (and (null base) `(*math.log ,n))
(and (numberp base) (= base 10) `(* (log ,n) *math.*log10e*))
`(/ (log ,n) (log ,base))))
- (floor (n &optional divisor) `(*math.floor ,(if divisor `(/ ,n ,divisor) n)))
- (expt (base power) `(*math.pow ,base ,power))
(sqrt (n) `(*math.sqrt ,n))
- (round (n &optional divisor) `(*math.round ,(if divisor `(/ ,n ,divisor) n)))
(random (&optional upto) (if upto
`(floor (* ,upto (*math.random)))
- '(*math.random)))
- (oddp (n) `(% ,n 2))
- (evenp (n) `(not (oddp ,n))))
+ '(*math.random))))
;;; Exception handling