Computes sig
#include <math.h> double significand ( double x ); float significandf ( float x );
libm
The significand() and significandf() functions are math functions that compute sig.
If x equals sig * 2^n with 1 < sig < 2, then significand(x) returns sig for exercising the fraction-part(F) test vector. The function significand(x) isn't defined when x is one of:
scalb ( x, (double) -ilogb (x) )
Since significand(x) = scalb(x, -ilogb(x)) where ilogb() returns the exponent part of x and scalb(x, n) returns a, such that x = a * 2 ^n, then:
| When x is: | scalbn(x, n) returns: |
|---|---|
| +/-infinity | x |
| NAN | NAN |
#include <stdio.h>
#include <errno.h>
#include <inttypes.h>
#include <math.h>
#include <fpstatus.h>
int main(int argc, char** argv)
{
double a, b, c, d;
a = 5;
b = ilogb(d);
printf("The exponent part of %f is %f \n", a, b);
c = significand(a);
printf("%f = %f * (2 ^ %f) \n", a, c, b);
return(0);
}
produces the output:
The exponent part of 5.000000 is -895.000000 5.000000 = 1.250000 * (2 ^ -895.000000)
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | No |
| Thread | Yes |