intdiv() – return the integer portion of a division
Category: Maths
Positive / negative
Get positive value abs() function returns the absolute value of its number argument Example returning the distance regardless of how the values are passed
Modulo
The modulo operator returns the remainder after the left operand is divided by the right operand. The modulo operator will convert its operands to integers before performing the operation, rounding down.
Power of (Exponentiation)
Raise a number to the power of another number Use the exponentiation operator: ** Squared
Rounding values
Rounding value correctly intval() does not round values correctly!!!!As for C++, it simply converts to int and ignores decimal places. If you want a source value of say 5.6 to be converted to an integer of 6 and not 5, then use: Round down Round Up Round to a specific number of decimal places Value […]