From: David Vázquez Date: Mon, 24 Feb 2014 00:05:11 +0000 (+0100) Subject: Implement SQRT function X-Git-Url: http://repo.macrolet.net/gitweb/?p=jscl.git;a=commitdiff_plain;h=a3565f3064e7bf03582278017ac50a2aa8a04c89 Implement SQRT function --- diff --git a/src/compiler/compiler.lisp b/src/compiler/compiler.lisp index e3bac18..25ad560 100644 --- a/src/compiler/compiler.lisp +++ b/src/compiler/compiler.lisp @@ -1018,6 +1018,9 @@ (define-builtin expt (x y) `(method-call |Math| "pow" ,x ,y)) +(define-builtin sqrt (x) + `(method-call |Math| "sqrt" ,x)) + (define-builtin float-to-string (x) `(call |make_lisp_string| (method-call ,x |toString|))) diff --git a/src/numbers.lisp b/src/numbers.lisp index f5dee9a..a386972 100644 --- a/src/numbers.lisp +++ b/src/numbers.lisp @@ -94,6 +94,8 @@ (defun expt (base power) (expt base power)) (defun exp (power) (expt 2.718281828459045 power)) +(defun sqrt (x) (sqrt x)) + (defun gcd-2 (a b) (if (zerop b) (abs a)