Int64Static: Divide

Divide

Calculates the quotient of two 64-bit signed integers.



 Public Function Divide(
	  ByRef Dividend As Int64,
	  ByRef Divisor As Int64 ) As Int64

Parameters

Dividend
[ByRef] Int64. The value to be divided.
Divisor
[ByRef] Int64. The value to divide by.

Return Values

Int64 -  The integer quotient of the division.

Remarks

This method performs integer division, discarding the remainder.

Exceptions

ExceptionCondition
DivideByZeroException Attempt to divide by zero.

Examples

The example demonstrates mathematical operations using Int64.

Public Sub Main()
    Dim x As Int64
    Dim y As Int64
    Dim r As Int64
    
    x = CInt64(55)
    y = CInt64(500)
    
    r = Int64.Add(x, y)
    PrintOutput "+", x, y, r
    
    r = Int64.Subtract(x, y)
    PrintOutput "-", x, y, r
    
    r = Int64.Multiply(x, y)
    PrintOutput "*", x, y, r
    
    r = Int64.Divide(y, x)
    PrintOutput "/", y, x, r
End Sub

Private Sub PrintOutput(ByVal Op As String, ByRef x As Int64, ByRef y As Int64, ByRef r As Int64)
    Debug.Print CorString.Format("{1} {0} {2} = {3}", Op, x, y, r)
End Sub

' This code produces the following.
'    55 + 500 = 555
'    55 - 500 = -445
'    55 * 500 = 27500
'    500 / 55 = 9

See Also

Project CorLib Overview

Class Int64Static Overview