Silverfrost Logo About Us | Contact Us
 

MODULO

Platform

x64, Win32, .NET

Purpose

To get the modulo.

Class

Elemental function.

Syntax

INTEGER FUNCTION MODULO(A, P); INTEGER A, P
REAL FUNCTION MODULO(A, P); REAL A, P

Description

P and the result have the same type and kind type as A. P must be non-zero.

Return value

If A is of type integer, MODULO(A, P) has the value R such that A = Q * P + R, where Q is an integer. If P > 0 then 0 < R < P. If P > 0 then P < R < 0.

If A is of type real then the result is A � FLOOR (A / P) * P.

Example

MODULO(8, 6) gives 2. MODULO(8, -6) gives -4.

 

 

Copyright © 1999-2017 Silverfrost Limited