DeserializeHexReal (FUN)

FUNCTION DeserializeHexReal : BOOL

Converts a string of the format
F16#{Mantissa}H{Exponent} | F16#NaN | F16#+Inf | F16#-Inf
where both mantissa and exponent are hexadecimal numerals, such that liM * 2^iE = {Mantissa} * 16^{Exponent}.

Returns true on success and false if the format is invalid or if an overflow occurred (i.e. when the mantissa does not fit into an LINT or the exponent does not fit into an INT.)

Note

  • Leading whitespace is not allowed.

  • Any characters that come after the hex real are ignored.

See also SerializeHexReal.

InOut:

Scope

Name

Type

Comment

Return

DeserializeHexReal

BOOL

Input

ps

POINTER TO BYTE

Pointer to the input string

Output

liM

LINT

The (signed) mantissa

iE

INT

The (unbiased) exponent

xNaN

BOOL

True iff ps^ is ‘F16#NaN’, iE and diM are 0 in this case

xInf

BOOL

True iff ps^ is ‘F16#+Inf’ of ‘F16#-Inf’, diM = 1 for +Infinity and -1 for -Infinity, iE is 0