/* Copyright (c) 1995 by R. A. Vowels, from "Introduction to PL/I, Algorithms, and */
/* Structured Programming". Permission is given to reproduce and to use these procedures */
/* as part of a program, and to include them as part of a larger work to be sold for profit. */
/* However, the user is not permitted to sell the procedures separately. Provided always */
/* that these procedures and this copyright notice are reproduced in full. */
DECLARE REM GENERIC
(REMI WHEN (FIXED BINARY, FIXED BINARY),
REMD WHEN (FIXED DECIMAL, FIXED DECIMAL),
REMF WHEN (*, *) );
/* This function procedure computes the remainder after dividing argument A by argument B. */
(FIXEDOVERFLOW):
REMI:
PROCEDURE (A, B) RETURNS (FIXED BINARY(31));
DECLARE (A, B) FIXED BINARY(31);
RETURN (A - B*TRUNC(A/B) );
END REMI;
(FIXEDOVERFLOW):
REMD:
PROCEDURE (A, B) RETURNS (FIXED DECIMAL(15));
DECLARE (A, B) FIXED DECIMAL(15);
RETURN (A - B*TRUNC(A/B) );
END REMD;
REMF:
PROCEDURE (A, B) RETURNS (FLOAT(16));
DECLARE (A, B) FLOAT(16);
RETURN (A - B*TRUNC(A/B) );
END REMF;