diff options
Diffstat (limited to 'js/src/tests/test262/ch12/12.9/S12.9_A4.js')
-rw-r--r-- | js/src/tests/test262/ch12/12.9/S12.9_A4.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch12/12.9/S12.9_A4.js b/js/src/tests/test262/ch12/12.9/S12.9_A4.js new file mode 100644 index 000000000..97c923979 --- /dev/null +++ b/js/src/tests/test262/ch12/12.9/S12.9_A4.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production ReturnStatement : return Expression; is evaluated as: + * i) Evaluate Expression. + * ii) Call GetValue(Result(2)). + * iii) Return (return, Result(3), empty) + * + * @path ch12/12.9/S12.9_A4.js + * @description Return very sophisticated expression and function + */ + +// second derivative +function DD_operator(f, delta){return function(x){return (f(x+delta)-2*f(x)+f(x-delta))/(delta*delta)};} + +DDsin = DD_operator(Math.sin, 0.00001); + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +// ((sin(x))')' = -sin(x) +if (DDsin( Math.PI/2 ) + Math.sin( Math.PI/2 ) > 0.00001) { + $ERROR('#1: return Expression yields to Return (return, GetValue(Evaluate Expression), empty)'); +} +// +////////////////////////////////////////////////////////////////////////////// + |