From a3565f3064e7bf03582278017ac50a2aa8a04c89 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20V=C3=A1zquez?= Date: Mon, 24 Feb 2014 01:05:11 +0100 Subject: [PATCH] Implement SQRT function --- src/compiler/compiler.lisp | 3 +++ src/numbers.lisp | 2 ++ 2 files changed, 5 insertions(+) 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) -- 1.7.10.4