sqrt - This function computes the square root of a number.
sqrt(argument)
This mathematical function computes the square root of a number defined in the real and positive plane. It returns a number y whose square is x, meaning that y multiplied by itself equals x. X needs always to be positive whereas y can be both positive or negative. However, the given answer will always be the positive value of y. Since the square root of a negative number equals a complex number, that is a real number plus an imaginary number, the latter being not defined for this function the user will receive Not a number as an answer.
Note: In the followings examples, the _ between the { should be removed to make it work.
One can use this function with a variable : test(q(res={_{ %include "/includes/extenso.sn"; a=4; sqrt(a); }}.), q(res=2.)); With a trigonometric function: test(q(res={_{ %include "/includes/extenso.sn"; a=cos(0); sqrt(a); }}.), q(res=1.)); With a float: test(q(res={_{sqrt(0.99);}}.),q(res=.994987.)); With big integers: test(q(res={_{sqrt(45);}}.),q(res=6.7082.)); With an array: test(q(res={_{sqrt(25,0,4);}}.),q(res=\[5,0,2\].)); But not with negative numbers: test(q(res={_{sqrt(-4);}}.),q(res=NAN.));
Written by Caroline Laplante, <claplante@sednove.com>
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis.
1.0 2014-09-09 21:24:14 laplante@sednove.com