Core Function Math

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
UberFoX (Talk | contribs)
(Created page with "<pre> Math( <expression> ) </pre> === Description === Parse a string containing mathematical equations. === Parameters === ==== expression ==== Any valid numeric expression....")
Newer edit →

Revision as of 09:48, 3 December 2011

Math( <expression> )

Contents

Description

Parse a string containing mathematical equations.

Parameters

expression

Any valid numeric expression.

Return Value

Returns the resolved number.

Remarks

This is very similar to Eval() however attempts to return the numeric value and is better than Eval() for this task.

Example

// A simple one
$val = Math("  100 + (100 / 2)   ");
println($val);
 
// Using variables
$a = 90;
$val = Math("  100 + ($a / 2)   ");
println($val);
 
// Using constants and functions
$val = Math("  @PI + 100 + ($a / 2) + Abs(-1000) + Math( '100 + 1337' )  ");
println($val);
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox