Division
From Xojo Documentation
The / character is used to perform floating-point division between two numbers.
Usage
result=expression1 / expression2
Part | Type | Description |
---|---|---|
result | Double | The division of expression1 and expression2. |
expression1 | Number | Any numeric expression. |
expression2 | Number | Any numeric expression. |
Notes
Use this operator when you require division that considers the decimal portion of the expressions. You can use Operator_Divide to define the / operator for classes.
Regardless of the datatypes of expression1 and expression2, both operands are coerced to Doubles and the result is a Double. If you divide by zero, the result is positive or negative infinity, except if the numerator is also zero. In that case, the result is NaN. For that reason, you should always check to see whether the denominator is zero before using /.
Use the \ operator for integer division or the Mod operator to get the remainder of the division.
Sample Code
This example stores the quotient of two numbers in a variable:
See Also
Integer_Division , Mod operators; Operator_Divide function; Operator_Precedence