/* Copyright (c) 1996 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. */
SCALE:
PROCEDURE (X, N) RETURNS (FLOAT);
DECLARE X FLOAT;
DECLARE N FIXED BINARY;
IF N > 0 THEN
RETURN (X * RADIX(X)**N);
IF N = 0 THEN
RETURN (X);
RETURN (X / RADIX(X)**-N);
END SCALE;
RADIX:
PROCEDURE (N) RETURNS (FIXED BINARY);
DECLARE N FIXED BINARY;
DECLARE X FLOAT STATIC INITIAL (1.0);
IF UNSPEC (X) = '00000100000100000000000000000000'B THEN
RETURN (16); /* Base 16 for IBM S/390 */
ELSE
RETURN (2);
END RADIX;