Mod8 Operator and Function

Purpose

Calculates the modulo of an integer expression based on a second integer expression.

Syntax

l = i Mod8 j( operator)
l = Mod8( i, j [,m,…] )( function)

i, j, m, l:64-bit integer expression

Description

The operator i Mod8 j and the function Mod8(i, j, …) return a 64-bit integer value. In case one of the parameters isn't an Int64, it is converted to a 64-bit value first (using CLarge).

Example

Debug.Show

Dim b As Double = 7.1, c As Large, d As Int

Trace b Mod 3           // CLarge(b) Mod 3 = 1

Trace Mod(b, 3)         // CLarge(b) Mod 3 = 1

Trace b Mod8 3.1        // 2 + CLarge(3.1) = 1

Trace b Mod8 4          // 3

Trace Mod8(b, 3)        // b Mod8 3 = 3 - Not Correct

Trace Mod8(7, 4, 3)     // 3 - Not Correct

' Mod Command requires an integer variable

c = 42, d = 42

Mod c, 5 : Trace c      // 5 - Not Correct

Mod d, 5 : Trace d      // 2 - Correct

Known Issues

The Mod8() function does not appear to work correctly; where possible, use the Mod8 operator instead.

The type independent Mod v, y assignment command doesn't work correctly when v is not an integer.

See Also

Add8, Sub8, Mul8, Div8, +, -, *, /, \, ++, --, +=, -=, /= , *=, Operator Hierarchy

{Created by Sjouke Hamstra; Last updated: 18/10/2014 by James Gaite}