﻿ Widget Designer > Scripting > Object and Member Notation (dot syntax) > Math Object

# Math Object   # Math Object   The Math object offers a wide variety of mathematical functions. It always returns the computed result as a numeric value without changing the argument itself.

Find here a list of all available methods. Remember to assign a suiting type to the variable for the result, e.g. "Double". In the interests of clarity, the result is rounded to two digits.

Description and Syntax

Result

Abs returns the absolute value of a specified number.

varRes = Math.Abs(-1.23)

1.23

Acos returns the angle whose cosine is the specified number (in radians!).

varRes = Math.Acos(0.99)

0.14

Asin returns the angle whose sine is the specified number (in radians!).

varRes = Math.Asin(0.99)

1.43

Atan returns the angle whose tangent is the specified number (in radians!).

varRes = Math.Atan(0.99)

0.78

Ceiling returns the smallest integer greater than or equal to the specified number.

varRes = Math.Ceiling(1.5)

2

Cos returns the cosine of the specified angle (in radians!).

varRes = Math.Cos(30)

0.15

The formula is: 1° × π/180 = 0,01745rad

3.14

E returns the mathematical constant "Eulers number"

varRes = Math.E

2.72

Exp returns e (Eulers number) raised to the specified power.

varRes = Math.Exp(1)

2.72

Floor returns the largest integer less than or equal to the specified number.

varRes = Math.Floor(1.5)

1

Log returns the natural logarithm of a specified number.

varRes = Math.Log(2.718)

0.99

Log10 returns the base 10 logarithm of a specified number.

varRes = Math.Log10(5)

0.7

Max returns the larger of two specified numbers.

varRes = Math.Max(1, 2)

2

Min returns the smaller of two numbers.

varRes = Math.Min(3, 4)

3

Mod returns the remainder after the division of one number by another.

varRes = Math.Mod(10, 3)

1

Pi returns the mathematical constant π ("Archimedes' constant")

varRes = Math.Pi

3.14x

Pow returns a specified number raised to the specified power.

varRes = Math.Pow(5, 2)

25

The formula is: 1° × π/180 = 0,01745rad

180

Returns a random integer value between the indicated min and max value. As common practice in most programming languages, the lower bound is included, the upper bound is excluded from the returned numbers.

varRes = Math.Random(0, 100)

42

Round rounds a value to the nearest integer or specified number of decimal places.

varRes = Math.Round(1.234, 2)

1.23

Sign returns a value indicating the sign of a number.

varRes = Math.Sign(-10)

-1

Sin returns the sine of the specified angle (in radians!).

varRes = Math.Sin(30)

-0.99

Sqrt returns the square root of a specified number.

varRes = Math.Sqrt(25)

5

Tan returns the tangent of the specified angle (in radians!).

varRes = Math.Tan(30)

-6.41

Truncate calculates the integral part of a number.

varRes = Math.Truncate(10.73)

10