Operator

/ (Division)


Description

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 </api/math/integer_division> 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:

Var x As Double
x = 50.56 / 30.34 // x is 1.6664469

Compatibility

All project types on all supported operating systems.

See also

Integer Division , Mod operators; Operator Divide function; Operator Precedence