Float numbers
Operators and functions for working with decimal numbers of float type are described here.

Operators

Operator
Result
Description
float ?
bool
Calls bool(float).
float + float
float
Adds two numbers.
float + int
float
int + float
float
float - float
float
Subtracts second number from the first.
float - int
float
int - float
float
float * float
float
Multiplies both numbers.
float * int
float
int * float
float
float / float
float
The division of two numbers. When dividing by zero, an error is returned.
float / int
float
int / float
float
float == float
bool
Returns true if two numbers are equal and false, otherwise.
float == int
bool
float > float
bool
Returns true if the first number is greater than the second and false, otherwise.
float > int
bool
float < float
bool
Returns true if the first number is less than the second and false, otherwise.
float < int
bool
float != float
bool
Returns true if two numbers are not equal and false, otherwise.
float != int
bool
float >= float
bool
Returns true if the first number is greater than or equal to the second and false, otherwise.
float >= int
bool
float <= float
bool
Returns true if the first number is less than or equal to the second and false, otherwise.
float <= int
bool
- float
float
Change the sign of a decimal number.
float = float
float
Simple assignment operator.
float += float
float
Add and assignment operator.
float -= float
float
Subtract and assignment operator.
float /= float
float
Divide and assignment operator.
float *= float
float
Multiply and assignment operator.

Functions

bool(float f) bool

The bool function returns false if the passed parameter is 0.0, otherwise it returns true.

int(float f) int

The int function converts a decimal number to an integer number which is less than or equal to this number.

str(float f) str

The str function converts a decimal number to a string.

Ceil(float f) int

The Ceil function returns the least integer value greater than or equal to f.

Floor(float f) int

The Floor function returns the greatest integer value less than or equal to f.

Max(float fl, float fr) float

The Max function returns the maximum of two values.

Min(float fl, float fr) float

The Min function returns the minimum of two values.

Round(float f) int

The Round function returns the nearest integer, rounding half away from zero.
1
Round(4.5) // 5
2
Round(4.1) // 4
3
Round(4.9) // 5
Copied!

Round(float f, int digit) float

The Round function rounds f to the specified number of decimal places.
1
Round(4.567, 2) // 4.57
2
Round(4.111, 1) // 4.1
Copied!
Last modified 1yr ago