Fmod Operator

Purpose

Calculates the modulo of a floating point expression based on a second floating point or integer expression.

Syntax

fp = f Fmod x

fp, f:floating-point exp
x:any numeric exp

Description

Fmod calculates the modulo of a floating point expression based on a second floating point or an integer expression.

Example

Debug.Show

Local vDbl As Double = 142.8544

Trace Mod(142.8544, 15)

Trace 142.8544 Fmod 15

Trace vDbl

Trace vDbl Fmod 15

Trace 142 Fmod 2.6

Remarks

The assignment command Mod v, y calculates the modulo of the value in variable v based on the expression y. The Mod v, y assignment command doesn't work correctly when v is not an integer. To work with floating-point variables use v = v Fmod y.

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

See Also

Add, Sub, Mul, Div, Mod, Dec, Inc, Pred, ++, --, +=, -=, /= , *=

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