significand
significand(x)
Extract the significand(s)
(a.k.a. mantissa), in binary representation, of
a floatingpoint number or array. If x
is a nonzero finite number,
than the result will be a number of the same type on the interval
$[1,2)$. Otherwise x
is returned.
julia> significand(15.2)/15.2
0.125
julia> significand(15.2)*8
15.2
Examples
The significand(x)
function in Julia extracts the significand (also known as mantissa) in binary representation of a floatingpoint number or array. If the input x
is a nonzero finite number, the result will be a number of the same type within the interval [1, 2)
. If x
is not a finite number, it is returned as is.
Here are some examples of how the significand
function can be used:

Extract significand of a floatingpoint number:
julia> significand(15.2) 0.125
In this example, the significand of the floatingpoint number
15.2
is extracted and returned as0.125
.  Multiply the significand by a factor:
julia> significand(15.2) * 8 15.2
Here, the significand of
15.2
is multiplied by8
, resulting in the original value15.2
.
Common mistake example:
julia> significand(0)
ERROR: DomainError with 0.0:
significand is only defined for nonzero finite numbers.
In this example, the input 0
is not a finite number, so the significand
function throws a DomainError
. Make sure to provide a nonzero finite number as input to significand
to avoid this error.
See Also
cmp, float, get_bigfloat_precision, get_rounding, get_zero_subnormals, isapprox, maxintfloat, mod2pi, nextfloat, precision, prevfloat, rationalize, round, set_bigfloat_precision, set_rounding, set_zero_subnormals, significand, with_bigfloat_precision, with_rounding,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.