From TestScratchWiki
Calculation is the determination of something by using mathematics. One can evaluate an expression on the Scratch Wiki using the parser function #expr. There is a 14 digit limit for rational and irrational digits; rational numbers will show up as scientific notation as it passes the 14th digit.
Usage
To use this function, simply use the syntax {{#expr:expression}}. For example, {{#expr:2+2}} is equal to 4, but {{#expr:5/0}} will result in an error (division by zero is undefined), similar to an error produced by the template {{error}}. This function also accepts wiki variables in it; {{#expr:{{CURRENTDAY}}^2}} is equal to 900. Common supported operators include ,+,*,/,^,
brackets and common functions include sin( ), cos( ), tan( ), ln( ), abs( ), ceil( ), floor( ), mod( )
. Irrational numbers are also supported, such as pi and e.
Operators
Note:  In logic gate functions (not, and, or ), 0 equals false, 1 equals true. Other values always equal true. 
Operator  Explanation  Example 

+

Adds two operands together or a unary operator  {{#expr:5+5}} = 10 Five plus five is equal to ten. {{#expr:+7}} = 7(Positive) seven is equal to (positive) seven.



Subtracts two operands or a unary operator  {{#expr:103}} = 7 Ten minus three equals to seven. {{#expr:+8}} = 8(Positive) negative eight is equal to negative eight.

*

Multiplies two operands together  {{#expr:2*9}} = 18 Two multiplied by nine equals to eighteen.

/

Divides two operands  {{#expr:35/7}} = 5 Thirtyfive divided by seven is equal to five.

^

Exponent, Multiplies the number x times  {{#expr:4^3}} = 64 Four to the power of three is equal to sixtyfour.

!=

Inequality  {{#expr:2!=6}} = 1 Two is unequal (True(1)) to six. {{#expr:3+2^2!=7}} = 0Two to the power of two (four) plus three (seven) is not unequal (False(0)) to seven.

=

Equality  {{#expr:(42)^2=4}} = 1 Four minus two (two) to the power of two (four) is equal (True(1)) to four. {{#expr:9+3^2=144}} = 0Three to the power of two (nine) plus nine (eighteen) is not equal (False(0)) to one hundred and fortyfour.

>

Greater than  {{#expr:2>1}} = 1 Two is greater than (True(1)) one. {{#expr:e>e}} = 0The Euler number (2.71828...) is not greater than (False(0)) itself.

>=

Greater than or equal to  {{#expr:7>=7}} = 1 Seven is equal to (True(1)) seven. {{#expr:2>=0}} = 1Two is not greater than (False(0)) zero.

<

Less than  {{#expr:1<{{#expr:4/3}}}} = 1 One is less than (True(1)) fourthirds (1.333...). {{#expr:abs50<22}} = 0The absolute value of negative fifty (fifty) is not less than (False(0)) twentytwo.

<=

Less than or equal to  {{#expr:9<=(8+({{#expr:1/3}}+{{#expr:2/3}}))}} = 1 Nine is equal to (True(1)) one third added to two thirds. {{#expr:2<=1}} = 0Two is not less than (False(0)) one.

abs

Absolute value  {{#expr:abs6}} = 6 The absolute value of negative six is equal to (positive) six.

acos

Inverse of cos function  {{#expr:acos0.2}} = 1.3694384060046 The arccosine of zero and two tenths (one fifth) of a radian is about one and four tenths. {{#expr:acos(55*pi/180)}} = 0.284040117616The arccosine of fiftyfive degrees is about zero and three tenths.

and

Logical AND  {{#expr:5 and 4}} = 1 True(5) and True(4) is equal to True(1). {{#expr:0 and 0}} = 0False(0) and False(0) is equal to False(0).

asin

Inverse of sine function  {{#expr:asin0.5}} = 0.5235987755983 The arcsine of zero and five tenths (one half) of a radian is about zero and five tenths (one half). {{#expr:asin(35*pi/180)}} = 0.65715296949619The arcsine of thirtyfive degrees is about zero and seven tenths.

atan

Inverse of tan function  {{#expr:atan0.1}} = 0.099668652491162 The arctangent of zero and one tenth of a radian is about one and one tenth. {{#expr:atan(90*pi/180)}} = 1.0038848218539The arctangent of ninety degrees is about one.

ceil

Raises the decimal to the next integer  {{#expr:ceil3.9}} = 3 The ceiling of negative three and nine tenths is equal to negative three.

cos

Cosine function  {{#expr:cos0.8}} = 0.69670670934717 The cosine of zero and eight tenths (four fifths) of a radian is about zero and seven tenths. {{#expr:cos(3*pi/180)}} = 0.99862953475457The cosine of three degrees is about one.

div

Same as division  {{#expr:6 div 2}} = 3 Six divided by two is equal to three.

exp

Irrational number e (euler number) to x power  {{#expr:exp5}} = 148.41315910258 The Euler number to the power of five is about one hundred and fortyeight.

floor

Lowers the decimal to the next integer  {{#expr:floor6.79}} = 7 The floor of negative six and seventynine hundredths is equal to negative seven.

ln

Natural logarithm  {{#expr:ln(e^5)}} = 5 The (natural) logarithm for e to the power of five is five. {{#expr:ln pi/ln10}} = 0.49714987269413The base ten (natural) algorithm for pi is about zero and five tenths.

mod

Modulo, remainder  {{#expr:19 mod 7}} = 5 The remainder of nineteen divided by seven is five.

not

Logical NOT  {{#expr:not 4}} = 0 Not True(4) is equal to False(0). {{#expr:not 0}} = 1Not False(0) is equal to True(1).

or

Logical OR  {{#expr:0 or 0}} = 0 False(0) or False(0) is equal to False(0). {{#expr:0 or 5}} = 1False(0) or True(5) is equal to True(1).

round

Rounds the number to the xth digit after the decimal  {{#expr:1.4757027 round 3}} = 1.476 One and four million, seven hundred fiftyseven thousand, twentyseven tenmillionths rounded to the third digit after the decimal point is equal to one and four hundred seventysix thousandths. {{#expr:82978 round 2}} = 83000Eightytwo thousand, nine hundred and seventyeight rounded to the second digit before the decimal point is equal to eightythree thousand.

sin

Sine function  {{#expr:sin1}} = 0.8414709848079 The sine of one radian is about zero and eight tenths. {{#expr:sin(30*pi/180)}} = 0.5The sine of thirty degrees is equal to zero and five tenths (one half).

tan

Tangent function  {{#expr:tan0.9}} = 1.2601582175503 The tangent of zero and nine tenths (nine tenths) of a radian is about one and three tenths. {{#expr:tan(45*pi/180)}} = 1The tangent of fortyfive degrees is equal to one.

trunc

'Truncates' x into an integer without rounding  {{#expr:trunc7.8}} = 7 Truncated negative seven and eight tenths is equal to negative seven.

Therefore,
 {{#expr:(0or1)+1}} = 2
 {{#expr:0or not1}} = 0
 {{#expr:5}} = 5
 {{#expr:not not 1}} = 1
 {{#expr:not0 or not0 and not1}} = 1
 {{#expr:pi/pi and pi*pi/pi}} = 1
 {{#expr:.}} = 0
 {{#expr:.1}} = 0.1
 {{#expr:e6}} = 3.281718171541
 {{#expr:1e6}} = 1.0E6
Errors
An error will result if:
 An operator is missing a parameter.
 {{#expr:2+}} gives Expression error: Missing operand for +.
 There is an unexpected number or operator.
 {{#expr:2 3}} gives Expression error: Unexpected number.
 {{#expr:=}} gives Expression error: Unexpected = operator.
 An unsupported word or character is used.
 {{#expr:what}} gives Expression error: Unrecognized word "what".
 {{#expr:%}} gives Expression error: Unrecognized punctuation character "%".
 A mathematical error occurs.
 {{#expr:1/0}} gives Division by zero.
 {{#expr:ln1}} gives Invalid argument for ln: <= 0.
If a number is too large, it returns INF (positive infinity) or INF (negative infinity).
 {{#expr:1e309}} gives INF
 {{#expr:1e309}} gives INF