Mant()

Purpose

Determines the mantissa of a floating-point value

Syntax

int = Mant(fexp)

Description

Mant() determines the mantissa of a floating point value. It is part of a set of three functions, GetExp(), LdExp() and Mant(), that break down a floating-point value.

The GetExp() and Mant() correspond to the frexp C-function, which breaks down the floating-point value (fexp) into a mantissa (m) and an exponent (n), such that the absolute value of m is greater than or equal to 0.5 and less than 1.0, and x = m*2n. The integer exponent n is obtained using GetExp() and m with Mant().

LdExp(m, exp) computes a real number from the mantissa and exponent.

Example

OpenW 1

Local Double a, b, i, c, x

Print GetExp(197)               // Prints 8

a = GetExp(197)

Print Mant(197)                 // Prints 0.76953125

b = Mant(197)

c = LdExp(a, b)

Print c                         // Prints 197

x = 111

Print 2 ^ GetExp(x) * Mant(x)   // Prints 111

Remarks

See Also

LdExp(), GetExp()

{Created by Sjouke Hamstra; Last updated: 13/10/2014 by James Gaite}