[pypy-commit] lang-js default: 15.8.2.2
stepahn
noreply at buildbot.pypy.org
Fri Dec 28 11:33:53 CET 2012
Author: Stephan <stephan at stzal.com>
Branch:
Changeset: r213:1dffc858a8dd
Date: 2012-05-22 18:25 +0200
http://bitbucket.org/pypy/lang-js/changeset/1dffc858a8dd/
Log: 15.8.2.2
diff --git a/js/builtins_math.py b/js/builtins_math.py
--- a/js/builtins_math.py
+++ b/js/builtins_math.py
@@ -22,6 +22,8 @@
put_native_function(w_Math, 'log', js_log, params = ['x'])
put_native_function(w_Math, 'sin', js_sin, params = ['x'])
put_native_function(w_Math, 'tan', js_tan, params = ['x'])
+ put_native_function(w_Math, 'acos', js_acos, params = ['x'])
+
# 15.8.1
@@ -223,6 +225,19 @@
return math.tan(x)
+# 15.8.2.2
+def js_acos(this, args):
+ arg0 = get_arg(args, 0)
+ x = arg0.ToNumber()
+
+ if isnan(x) or isinf(x):
+ return NAN
+
+ if x > 1 or x < -1:
+ return NAN
+
+ return math.acos(x)
+
import time
from pypy.rlib import rrandom
_random = rrandom.Random(int(time.time()))
More information about the pypy-commit
mailing list