1LOGB(P)                    POSIX Programmer's Manual                   LOGB(P)
2
3
4

NAME

6       logb, logbf, logbl - radix-independent exponent
7

SYNOPSIS

9       #include <math.h>
10
11       double logb(double x);
12       float logbf(float x);
13       long double logbl(long double x);
14
15

DESCRIPTION

17       These  functions shall compute the exponent of x, which is the integral
18       part of log_r |x|, as a signed floating-point value,  for  non-zero  x,
19       where  r is the radix of the machine's floating-point arithmetic, which
20       is the value of FLT_RADIX defined in the <float.h> header.
21
22       If x is subnormal it is treated as though it were normalized; thus  for
23       finite positive x:
24
25
26              1 <= x * FLT_RADIX**-logb(x) < FLT_RADIX
27
28       An  application  wishing to check for error situations should set errno
29       to zero and  call  feclearexcept(FE_ALL_EXCEPT)  before  calling  these
30       functions.   On return, if errno is non-zero or fetestexcept(FE_INVALID
31       | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error  has
32       occurred.
33

RETURN VALUE

35       Upon  successful  completion, these functions shall return the exponent
36       of x.
37
38       If x is ±0, a pole error shall occur and logb(), logbf(),  and  logbl()
39       shall return -HUGE_VAL, -HUGE_VALF, and -HUGE_VALL, respectively.
40
41       If x is NaN, a NaN shall be returned.
42
43       If x is ±Inf, +Inf shall be returned.
44

ERRORS

46       These functions shall fail if:
47
48       Pole Error
49              The value of x is ±0.
50
51       If  the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
52       then errno  shall  be  set  to  [ERANGE].  If  the  integer  expression
53       (math_errhandling  &  MATH_ERREXCEPT)  is non-zero, then the divide-by-
54       zero floating-point exception shall be raised.
55
56
57       The following sections are informative.
58

EXAMPLES

60       None.
61

APPLICATION USAGE

63       On  error,  the  expressions  (math_errhandling   &   MATH_ERRNO)   and
64       (math_errhandling  & MATH_ERREXCEPT) are independent of each other, but
65       at least one of them must be non-zero.
66

RATIONALE

68       None.
69

FUTURE DIRECTIONS

71       None.
72

SEE ALSO

74       feclearexcept() , fetestexcept() , ilogb() , scalb() , the Base Defini‐
75       tions  volume of IEEE Std 1003.1-2001, Section 4.18, Treatment of Error
76       Conditions for Mathematical Functions, <float.h>, <math.h>
77
79       Portions of this text are reprinted and reproduced in  electronic  form
80       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
81       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
82       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
83       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
84       event of any discrepancy between this version and the original IEEE and
85       The Open Group Standard, the original IEEE and The Open Group  Standard
86       is  the  referee document. The original Standard can be obtained online
87       at http://www.opengroup.org/unix/online.html .
88
89
90
91IEEE/The Open Group                  2003                              LOGB(P)
Impressum