significand
Return the significand of x in floating-point format.
Interface Definition
C interface:
float significandf(float x);
double significand(double x);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
x |
|
Floating-point value of the input data |
Input |
Return Value
- The significand of x is returned. |y| ∈ [1, 2).
- If the input is +0, the return value is +0.
- If the input is -0, the return value is -0.
- If the input is ±∞, the return value is ±∞.
- If the input is NaN, the return value is NaN.
Dependencies
C: "km.h"
Examples
C interface:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | // typical usage double x1 = 0.0, x2 = -0.0, x3 = 1.5, x4 = -2.5, x5 = 0x1p-1024; // special handling double a = INFINITY, b = -INFINITY, c = NAN; // print result printf("significand(0.0) = %.15f\n", significand(x1)); printf("significand(-0.0) = %.15f\n", significand(x2)); printf("significand(1.5) = %.15f\n", significand(x3)); printf("significand(-2.5) = %.15f\n", significand(x4)); printf("significand(0x1p-1024) = %.15f\n", significand(x5)); printf("significand(INFINITY) = %.15f\n", significand(a)); printf("significand(-INFINITY) = %.15f\n", significand(b)); printf("significand(NAN) = %.15f\n", significand(c)); /* * significand(0.0) = 0.000000000000000 * significand(-0.0) = -0.000000000000000 * significand(1.5) = 1.500000000000000 * significand(-2.5) = -1.250000000000000 * significand(0x1p-1024) = 1.000000000000000 * significand(INFINITY) = inf * significand(-INFINITY) = -inf * significand(NAN) = nan * * */ |
Parent topic: Miscellaneous Functions