Float numbers
Last updated
Last updated
Operators and functions for working with decimal numbers of float type are described here.
The bool function returns false if the passed parameter is 0.0, otherwise it returns true.
The int function converts a decimal number to an integer number which is less than or equal to this number.
The str function converts a decimal number to a string.
The Ceil function returns the least integer value greater than or equal to f.
The Floor function returns the greatest integer value less than or equal to f.
The Max function returns the maximum of two values.
The Min function returns the minimum of two values.
The Round function returns the nearest integer, rounding half away from zero.
The Round function rounds f to the specified number of decimal places.
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.