IEEE_TEST(3)
β¨ IEEE_TEST(3) β¨
okay so this is a page from the Library Functions Manual and it's literally called IEEE_TEST β yes bestie, the whole manual, and it lives in section 3 π
π NAME π
scalb, scalbf, significand, significandf β the IEEE test functions πΈ
π LIBRARY π
Math Library (libm, -lm) β so you're gonna want that -lm on your link line, no cap π«Ά
π¦ SYNOPSIS π¦
#include <math.h>
double
scalb(double x, double n);
float
scalbf(float x, float n);
double
significand(double x);
float
significandf(float x);
π DESCRIPTION π
okay so these functions exist for exactly one reason: they let you test conformance to IEEE Std 754-1985. that's it. that's the whole gig. the manual is very clear that "their use is not otherwise recommended" β like, it's giving diagnostic tool only, not main character energy π
scalb(x, n) and scalbf(x, n) return xβ(2n), and the way they do it is by pure **exponent manipulation. so cute, so efficient β¨
β οΈ but listen β if n is not an integer, or if it's Β±β, or if it's a NaN, then the result is unspecified. not undefined-in-a-fun-way, unspecified-in-a-please-don't-do-this-way. you've been warned, bestie π
significand(x) and significandf(x) return sig, where:
x := sig β 2**n
and sig sits in the range 1 β€ sig < 2. adorable. very normalized. very slay π
π¨ BUT βsignificand(x)andsignificandf(x)are not defined whenxis0,Β±β, orNaN. like, don't. just don't. π
π₯ SEE ALSO π₯
the girlies to check out next, fr fr π§
β STANDARDS β
IEEE Std 754-1985 β the blueprint, the origin story, the moment π
that's the whole page, bestie!! this one came from Debian and it's dated November 6, 2005 β vintage, honestly π go test your IEEE conformance and stay hydrated πβ¨
π¦ where this page comes from
- freebsd 15.1: base 15.1
- Copyright (c) 1985, 1991 Regents of the University of California
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms