# LRealStr

### Import List

        ConvTypes

Type Summary
ConvResults = ConvResults One of strAllRight, strOutOfRange, strWrongFormat, or strEmpty.

Procedure Summary
RealToEng(LONGREAL, INTEGER, VAR ARRAY OF CHAR) Converts the value of real to floating-point string form, with sigFigs significant figures, and copies the possibly truncated result to str.
RealToFixed(LONGREAL, INTEGER, VAR ARRAY OF CHAR) The call ``RealToFixed(real,place,str)`' assigns to str the possibly truncated string corresponding to the value of real in fixed-point form.
RealToFloat(LONGREAL, INTEGER, VAR ARRAY OF CHAR) Assign to str the possibly truncated string corresponding to the value of real in floating-point form.
RealToStr(LONGREAL, VAR ARRAY OF CHAR) If the sign and magnitude of real can be shown within the capacity of str, the call ``RealToStr(real,str)`' behaves as the call ``RealToFixed(real,place,str)`', with a value of ``place`' chosen to fill exactly the remainder of str.
StrToReal(ARRAY OF CHAR, VAR LONGREAL, VAR ConvResults)

Constant Summary
strAllRight The string format is correct for the corresponding conversion.
strEmpty The given string is empty.
strOutOfRange The string is well-formed but the value cannot be represented.
strWrongFormat The string is in the wrong format for the conversion.

Type Detail

### ConvResults

    TYPE ConvResults = ConvResults

> One of strAllRight, strOutOfRange, strWrongFormat, or strEmpty.

Procedure Detail

### RealToEng

    PROCEDURE RealToEng(real: LONGREAL;
                        sigFigs: INTEGER;
                        VAR str: ARRAY OF CHAR)

> Converts the value of real to floating-point string form, with sigFigs significant figures, and copies the possibly truncated result to str. The number is scaled with one to three digits in the whole number part and with an exponent that is a multiple of three. For example:

> >     value:   3923009     39.23009   0.0003923009
> >     sigFigs
> >     1        4E+6        40         400E-6
> >     2        3.9E+6      39         390E-6
> >     5        3.9230E+6   39.230     392.30E-6

### RealToFixed

    PROCEDURE RealToFixed(real: LONGREAL;
                          place: INTEGER;
                          VAR str: ARRAY OF CHAR)

> The call ``RealToFixed(real,place,str)`' assigns to str the possibly truncated string corresponding to the value of real in fixed-point form. A sign is included only for negative values. At least one digit is included in the whole number part. The value is rounded to the given value of place relative to the decimal point. The decimal point is suppressed if place is less than ``0`'. For example:

> >     value:    3923009         3.923009   0.0003923009
> >     sigFigs
> >     -5        3920000         0          0
> >     -2        3923010         0          0
> >     -1        3923009         4          0
> >     0         3923009.        4.         0.
> >     1         3923009.0       3.9        0.0
> >     4         3923009.0000    3.9230     0.0004

### RealToFloat

    PROCEDURE RealToFloat(real: LONGREAL;
                          sigFigs: INTEGER;
                          VAR str: ARRAY OF CHAR)

> Assign to str the possibly truncated string corresponding to the value of real in floating-point form. A sign is included only for negative values. One significant digit is included in the whole number part. The signed exponent part is included only if the exponent value is not 0. If the value of sigFigs is greater than 0, that number of significant digits is included, otherwise an implementation-defined number of significant digits. The decimal point shall is not included if there are no significant digits in the fractional part.

> For example:

> >     value:   3923009     39.23009     0.0003923009
> >     sigFigs
> >     1        4E+6        4E+1         4E-4
> >     2        3.9E+6      3.9E+1       3.9E-4
> >     5        3.9230E+6   3.9230E+1    3.9230E-4

### RealToStr

    PROCEDURE RealToStr(real: LONGREAL;
                        VAR str: ARRAY OF CHAR)

> If the sign and magnitude of real can be shown within the capacity of str, the call ``RealToStr(real,str)`' behaves as the call ``RealToFixed(real,place,str)`', with a value of ``place`' chosen to fill exactly the remainder of str. Otherwise, the call behaves as the call ``RealToFloat(real,sigFigs,str)`', with a value of ``sigFigs`' of at least one, but otherwise limited to the number of significant digits that can be included together with the sign and exponent part in str.

### StrToReal

    PROCEDURE StrToReal(str: ARRAY OF CHAR;
                        VAR real: LONGREAL;
                        VAR res: ConvResults)

Constant Detail

### strAllRight

    CONST strAllRight

> The string format is correct for the corresponding conversion.

### strEmpty

    CONST strEmpty

> The given string is empty.

### strOutOfRange

    CONST strOutOfRange

> The string is well-formed but the value cannot be represented.

### strWrongFormat

    CONST strWrongFormat

> The string is in the wrong format for the conversion.