 SFloatMantissa - Maple Programming Help

Home : Support : Online Help : Mathematics : Numerical Computations : Maple Numerics : Functions : SFloatMantissa

SFloatMantissa

return the mantissa of a floating-point number

SFloatExponent

return the exponent of a floating-point number

 Calling Sequence SFloatMantissa(x,base) SFloatExponent(x,base)

Parameters

 x - software or hardware floating-point number base - (optional) 2 or default 10

Description

 • The SFloatMantissa(x) function returns the mantissa field of x as a Maple integer.
 If x is any numeric argument other than a floating-point number, an error is generated. Otherwise, this function returns unevaluated.
 • The SFloatExponent(x) function returns the exponent field of x as a Maple integer, symbolic infinity, or undefined.
 If x is any numeric argument other than a floating-point number, an error is generated. Otherwise, this function returns unevaluated.
 • For all software floating-point numbers x (including software float infinities and undefineds), SFloat( SFloatMantissa(x), SFloatExponent(x) ) = x.
 • These functions can be used for hardware floating-point numbers (see HFloat) with the second argument of 2. Such numbers are represented internally in the form mantissa  2^exponent.
 • When the optional base argument is omitted or set to 10, hardware floating-point numbers may still be passed to SFloatMantissa and SFloatExponent.  This will result in an implicit conversion to software floating-point format before the operation is carried out.
 Note that SFloatMantissa(HFloat(m,e)) and SFloatMantissa(HFloat(m,e,2),2) are not usually equal to m.  When HFloat(m,e) or HFloat(m,e,2) is created, the mantissa and exponent are normalized to the standard underlying 64-bit hardware double representation. Extracting the mantissa or exponent using the base-2 option returns the mantissa or exponent as stored.  Extracting the mantissa or exponent in base-10 form incurs a conversion to an equivalent software floating-point format that may not exactly match the input expression.
 • For all hardware floating-point numbers x (including hardware float infinities and undefined's), HFloat( SFloatMantissa(x), SFloatExponent(x) ) = x, and HFloat( SFloatMantissa(x,2), SFloatExponent(x,2), 2 ) = x.

 • The SFloatMantissa and SFloatExponent commands are thread-safe as of Maple 15.

Examples

 > $a≔\mathrm{Float}\left(2.345678,3\right)$
 ${a}{≔}{2345.678}$ (1)
 > $\mathrm{SFloatMantissa}\left(a\right)$
 ${2345678}$ (2)
 > $\mathrm{SFloatExponent}\left(a\right)$
 ${-3}$ (3)
 > $\mathrm{SFloat}\left(\mathrm{SFloatMantissa}\left(a\right),\mathrm{SFloatExponent}\left(a\right)\right)$
 ${2345.678}$ (4)
 > $b≔\mathrm{HFloat}\left(2.345678,3\right)$
 ${b}{≔}{2345.67800000000}$ (5)
 > $\mathrm{SFloatMantissa}\left(b\right)$
 ${234567799999999988}$ (6)
 > $\mathrm{SFloatExponent}\left(b\right)$
 ${-14}$ (7)
 > $\mathrm{SFloatMantissa}\left(b,2\right)$
 ${5158200472036704}$ (8)
 > $\mathrm{SFloatExponent}\left(b,2\right)$
 ${-41}$ (9)
 > $\mathrm{SFloatMantissa}\left(b,2\right){2.}^{\mathrm{SFloatExponent}\left(b,2\right)}$
 ${2345.678000}$ (10)
 > $\mathrm{HFloat}\left(\mathrm{SFloatMantissa}\left(a\right),\mathrm{SFloatExponent}\left(a\right)\right)$
 ${2345.67800000000}$ (11)