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