js/src/tests/test262/ch12/12.9/S12.9_A4.js

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:c9159328229b
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /**
5 * The production ReturnStatement : return Expression; is evaluated as:
6 * i) Evaluate Expression.
7 * ii) Call GetValue(Result(2)).
8 * iii) Return (return, Result(3), empty)
9 *
10 * @path ch12/12.9/S12.9_A4.js
11 * @description Return very sophisticated expression and function
12 */
13
14 // second derivative
15 function DD_operator(f, delta){return function(x){return (f(x+delta)-2*f(x)+f(x-delta))/(delta*delta)};}
16
17 DDsin = DD_operator(Math.sin, 0.00001);
18
19
20 //////////////////////////////////////////////////////////////////////////////
21 //CHECK#1
22 // ((sin(x))')' = -sin(x)
23 if (DDsin( Math.PI/2 ) + Math.sin( Math.PI/2 ) > 0.00001) {
24 $ERROR('#1: return Expression yields to Return (return, GetValue(Evaluate Expression), empty)');
25 }
26 //
27 //////////////////////////////////////////////////////////////////////////////
28

mercurial