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

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       logb, logbf, logbl - radix-independent exponent
13

SYNOPSIS

15       #include <math.h>
16
17       double logb(double x);
18       float logbf(float x);
19       long double logbl(long double x);
20
21

DESCRIPTION

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

RETURN VALUE

41       Upon successful completion, these functions shall return  the  exponent
42       of x.
43
44       If  x  is ±0, a pole error shall occur and logb(), logbf(), and logbl()
45       shall return -HUGE_VAL, -HUGE_VALF, and -HUGE_VALL, respectively.
46
47       If x is NaN, a NaN shall be returned.
48
49       If x is ±Inf, +Inf shall be returned.
50

ERRORS

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

EXAMPLES

66       None.
67

APPLICATION USAGE

69       On   error,   the   expressions  (math_errhandling  &  MATH_ERRNO)  and
70       (math_errhandling & MATH_ERREXCEPT) are independent of each other,  but
71       at least one of them must be non-zero.
72

RATIONALE

74       None.
75

FUTURE DIRECTIONS

77       None.
78

SEE ALSO

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