F2D

Syntax:

F2D(floatnum[,synerrval])

Arguments:

floatnum
the 4 or 8 byte System 370 floating point number to be converted. For information regarding the format of floating point numbers, refer to any edition of Principles of Operation.
synerrval
indicates the value to be returned if a syntax error is detected. This argument can be used to handle normally occurring invalid data. For example, null strings.

Module Name:

SWXF2D

Service Description:

The F2D function is used to convert System 370 floating point numbers into the REXX exponential number format. In every case, except one, the resulting REXX number is formatted using the REXX exponential notation. The exception occurs whenever the exponent part of the number (the part after the "E") is zero. In this case, blanks are supplied where the zero exponent would be, thus making the result a REXX decimal number.

Note: The output of F2D can easily be formatted into REXX decimal notation using one of the following methods:

  1. Set NUMERIC DIGITS sufficiently high enough to express the result, and then add zero to the number.
  2. Use the FORMAT function.

Returned Information:

The F2D function returns the REXX exponential number representation of floatnum. If you CALL the F2D function, the returned value is contained in the RESULT special variable. The RC special variable is unchanged.

Examples:

  1. Call the F2D function to convert the floating point number in F_PI:
    f_pi = '41323d70'x
    d_pi = f2d(f_pi)
    /* d_pi = 3.1399993896484 */
    


© Copyright 1998 by Open Software Technologies, Inc.