| 1 |
.\" Copyright 2004, Andries E. Brouwer <[email protected]> |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH INFINITY 3 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
INFINITY, NAN, HUGE_VAL, HUGE_VALF, HUGE_VALL \- floating-point constants |
| 9 |
.SH LIBRARY |
| 10 |
Math library |
| 11 |
.RI ( libm ) |
| 12 |
.SH SYNOPSIS |
| 13 |
.nf |
| 14 |
.BR "#define _ISOC99_SOURCE" " /* See feature_test_macros(7) */" |
| 15 |
.B #include <math.h> |
| 16 |
.P |
| 17 |
.B INFINITY |
| 18 |
.P |
| 19 |
.B NAN |
| 20 |
.P |
| 21 |
.B HUGE_VAL |
| 22 |
.B HUGE_VALF |
| 23 |
.B HUGE_VALL |
| 24 |
.fi |
| 25 |
.SH DESCRIPTION |
| 26 |
The macro |
| 27 |
.B INFINITY |
| 28 |
expands to a |
| 29 |
.I float |
| 30 |
constant representing positive infinity. |
| 31 |
.P |
| 32 |
The macro |
| 33 |
.B NAN |
| 34 |
expands to a |
| 35 |
.I float |
| 36 |
constant representing a quiet NaN |
| 37 |
(when supported). |
| 38 |
A |
| 39 |
.I quiet |
| 40 |
NaN is a NaN ("not-a-number") that does not raise exceptions |
| 41 |
when it is used in arithmetic. |
| 42 |
The opposite is a |
| 43 |
.I signaling |
| 44 |
NaN. |
| 45 |
See IEC 60559:1989. |
| 46 |
.P |
| 47 |
The macros |
| 48 |
.BR HUGE_VAL , |
| 49 |
.BR HUGE_VALF , |
| 50 |
.B HUGE_VALL |
| 51 |
expand to constants of types |
| 52 |
.IR double , |
| 53 |
.IR float , |
| 54 |
and |
| 55 |
.IR "long double" , |
| 56 |
respectively, |
| 57 |
that represent a large positive value, possibly positive infinity. |
| 58 |
.SH STANDARDS |
| 59 |
C11. |
| 60 |
.SH HISTORY |
| 61 |
C99. |
| 62 |
.P |
| 63 |
On a glibc system, the macro |
| 64 |
.B HUGE_VAL |
| 65 |
is always available. |
| 66 |
Availability of the |
| 67 |
.B NAN |
| 68 |
macro can be tested using |
| 69 |
.BR "#ifdef NAN" , |
| 70 |
and similarly for |
| 71 |
.BR INFINITY , |
| 72 |
.BR HUGE_VALF , |
| 73 |
.BR HUGE_VALL . |
| 74 |
They will be defined by |
| 75 |
.I <math.h> |
| 76 |
if |
| 77 |
.B _ISOC99_SOURCE |
| 78 |
or |
| 79 |
.B _GNU_SOURCE |
| 80 |
is defined, or |
| 81 |
.B __STDC_VERSION__ |
| 82 |
is defined |
| 83 |
and has a value not less than 199901L. |
| 84 |
.SH SEE ALSO |
| 85 |
.BR fpclassify (3), |
| 86 |
.BR math_error (7) |