Rate This Document
Findability
Accuracy
Completeness
Readability

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

  • For significandf, x is of single-precision floating-point type.
  • For significand, x is of double-precision floating-point type.

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:
    // typical usage
    double x1 = 0.0, x2 = -0.0, x3 = 1.5, x4 = -2.5, x5 = 0x1p-1024;
    // special handing
    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
     * 
     * */