1libm(3LIB)                    Interface Libraries                   libm(3LIB)
2
3
4

NAME

6       libm - C math library
7

SYNOPSIS

9       c99 [ flag... ] file... -lm [ library... ]
10
11

DESCRIPTION

13       Functions  in this library provide common elementary mathematical func‐
14       tions and floating point environment routines defined by System V, ANSI
15       C,  POSIX,  and  so  on. See standards(5). Additional functions in this
16       library provide extended support for  handling  floating  point  excep‐
17       tions.
18

INTERFACES

20       The  shared  object  libm.so.2  provides  the public interfaces defined
21       below. See Intro(3) for additional information on shared object  inter‐
22       faces.
23
24
25
26
27       acos                          acosf
28       acosh                         acoshf
29       acoshl                        acosl
30       asin                          asinf
31       asinh                         asinhf
32       asinhl                        asinl
33       atan                          atan2
34       atan2f                        atan2l
35       atanf                         atanh
36       atanhf                        atanhl
37       atanl                         cabs
38       cabsf                         cabsl
39       cacos                         cacosf
40       cacosh                        cacoshf
41       cacoshl                       cacosl
42       carg                          cargf
43       cargl                         casin
44       casinf                        casinh
45       casinhf                       casinhl
46       casinl                        catan
47       catanf                        catanh
48       catanhf                       catanhl
49       catanl                        cbrt
50       cbrtf                         cbrtl
51       ccos                          ccosf
52       ccosh                         ccoshf
53       ccoshl                        ccosl
54       ceil                          ceilf
55       ceill                         cexp
56       cexpf                         cexpl
57       cimag                         cimagf
58       cimagl                        clog
59       clogf                         clogl
60       conj                          conjf
61       conjl                         copysign
62       copysignf                     copysignl
63       cos                           cosf
64       cosh                          coshf
65       coshl                         cosl
66
67       cpow                          cpowf
68       cpowl                         cproj
69       cprojf                        cprojl
70       creal                         crealf
71       creall                        csin
72       csinf                         csinh
73       csinhf                        csinhl
74       csinl                         csqrt
75       csqrtf                        csqrtl
76       ctan                          ctanf
77       ctanh                         ctanhf
78       ctanhl                        ctanl
79       erf                           erfc
80       erfcf                         erfcl
81       erff                          erfl
82       exp                           exp2
83       exp2f                         exp2l
84       expf                          expl
85       expm1                         expm1f
86       expm1l                        fabs
87       fabsf                         fabsl
88       fdim                          fdimf
89       fdiml                         feclearexcept
90       fegetenv                      fegetexceptflag
91       fegetround                    feholdexcept
92       feraiseexcept                 fesetenv
93       fesetexceptflag               fesetround
94       fetestexcept                  feupdateenv
95       fex_get_handling              fex_get_log
96       fex_get_log_depth             fex_getexcepthandler
97       fex_log_entry                 fex_merge_flags
98       fex_set_handling              fex_set_log
99       fex_set_log_depth             fex_setexcepthandler
100       floor                         floorf
101       floorl                        fma
102       fmaf                          fmal
103       fmax                          fmaxf
104       fmaxl                         fmin
105       fminf                         fminl
106       fmod                          fmodf
107       fmodl                         frexp
108       frexpf                        frexpl
109       gamma                         gamma_r
110       gammaf                        gammaf_r
111       gammal                        gammal_r
112       hypot                         hypotf
113       hypotl                        ilogb
114       ilogbf                        ilogbl
115       isnan                         j0
116       j0f                           j0l
117       j1                            j1f
118       j1l                           jn
119       jnf                           jnl
120       ldexp                         ldexpf
121       ldexpl                        lgamma
122       lgamma_r                      lgammaf
123       lgammaf_r                     lgammal
124       lgammal_r                     llrint
125       llrintf                       llrintl
126       llround                       llroundf
127       llroundl                      log
128       log10                         log10f
129       log10l                        log1p
130       log1pf                        log1pl
131       log2                          log2f
132
133       log2l                         logb
134       logbf                         logbl
135       logf                          logl
136       lrint                         lrintf
137       lrintl                        lround
138       lroundf                       lroundl
139       matherr                       modf
140       modff                         modfl
141       nan                           nanf
142       nanl                          nearbyint
143       nearbyintf                    nearbyintl
144       nextafter                     nextafterf
145       nextafterl                    nexttoward
146       nexttowardf                   nexttowardl
147       pow                           powf
148       powl                          remainder
149       remainderf                    remainderl
150       remquo                        remquof
151       remquol                       rint
152       rintf                         rintl
153       round                         roundf
154       roundl                        scalb
155       scalbf                        scalbl
156       scalbln                       scalblnf
157       scalblnl                      scalbn
158       scalbnf                       scalbnl
159       signgam                       signgamf
160       signgaml                      significand
161       significandf                  significandl
162       sin                           sincos
163       sincosf                       sincosl
164       sinf                          sinh
165       sinhf                         sinhl
166       sinl                          sqrt
167       sqrtf                         sqrtl
168       tan                           tanf
169       tanh                          tanhf
170       tanhl                         tanl
171       tgamma                        tgammaf
172       tgammal                       trunc
173       truncf                        truncl
174       y0                            y0f
175       y0l                           y1
176       y1f                           y1l
177       yn                            ynf
178       ynl
179
180
181
182       The following interfaces are unique to the x86 and x64 versions of this
183       library:
184
185
186
187
188       fegetprec                     fesetprec
189
190

ACCURACY

192       ISO/IEC 9899:1999, also known as C99, specifies the functions listed in
193       the following tables and states that the accuracy of these functions is
194       "implementation-defined". The information below characterizes the accu‐
195       racy of these functions as implemented in libm.so.2. For each function,
196       the tables provide an upper bound on the largest error possible for any
197       argument  and  the largest error actually observed among a large sample
198       of arguments. Errors are expressed in "units in  the  last  place",  or
199       ulps, relative to the exact function value for each argument (regarding
200       the argument as exact). Ulps depend on the precision  of  the  floating
201       point  format:  if y is the exact function value, x and x' are adjacent
202       floating point numbers such that x < y < x', and x''  is  the  computed
203       function  value,  then  provided  x,  x',  and  x'' all lie in the same
204       binade, the error in x'' is |y - x''| / |x - x'| ulps.  In  particular,
205       when  the  error is less than one ulp, the computed value is one of the
206       two floating point numbers adjacent to the exact value.
207
208
209       The bounds and observed errors listed below apply only in  the  default
210       floating  point  modes. Specifically, on SPARC, these bounds assume the
211       rounding direction is round-to-nearest and non-standard  mode  is  dis‐
212       abled.  On  x86,  the bounds assume the rounding direction is round-to-
213       nearest and the rounding precision is  round-to-64-bits.  Moreover,  on
214       x86,  floating  point  function values are returned in a floating point
215       register in extended double precision  format,  but  the  bounds  below
216       assume  that  the  result  value is then stored to memory in the format
217       corresponding to the function's type. On x64,  the  bounds  assume  the
218       rounding  direction in both the x87 floating point control word and the
219       MXCSR is round-to-nearest, the rounding precision in  the  x87  control
220       word is round-to-64-bits, and the FTZ and DAZ modes are disabled.
221
222
223       The  error  bounds listed below are believed to be correct, but smaller
224       bounds might be proved later. The observed errors are the largest  ones
225       currently  known,  but larger errors might be discovered later. Numbers
226       in the notes column refer to the notes following the tables.
227
228   Real Functions
229   Single precision real functions (SPARC, x86, and x64)
230                         error bound      largest error
231          function          (ulps)       observed (ulps)       notes
232           acosf             1.0               < 1
233           acoshf            1.0               < 1
234           asinf             1.0               < 1
235           asinhf            1.0               < 1
236           atanf             1.0               < 1
237           atan2f            1.0               < 1
238           atanhf            1.0               < 1
239           cbrtf             1.0               < 1
240            cosf             1.0               < 1
241           coshf             1.0               < 1
242            erff             1.0               < 1
243           erfcf             1.0               < 1
244            expf             1.0               < 1
245           exp2f             1.0               < 1
246           expm1f            1.0               < 1
247           hypotf            1.0               < 1
248          lgammaf            1.0               < 1
249            logf             1.0               < 1
250           log10f            1.0               < 1
251           log1pf            1.0               < 1
252           log2f             1.0               < 1
253            powf             1.0               < 1
254            sinf             1.0               < 1
255           sinhf             1.0               < 1
256           sqrtf             0.5              0.500             [1]
257            tanf             1.0               < 1
258           tanhf             1.0               < 1
259          tgammaf            1.0               < 1
260
261
262   Double precision real functions (SPARC and x64)
263                         error bound      largest error
264
265          function          (ulps)       observed (ulps)       notes
266            acos             1.0               < 1
267           acosh             4.0              1.878
268            asin             1.0               < 1
269           asinh             7.0              1.653
270            atan             1.0               <1
271           atan2             2.5              1.475
272           atanh             4.0              1.960
273            cbrt             1.0               < 1
274            cos              1.0               < 1
275            cosh             3.0              1.168
276            erf              4.0              0.959
277            erfc             6.0              2.816
278            exp              1.0               < 1
279            exp2             2.0              1.050
280           expm1             1.0               < 1
281           hypot             1.0               < 1
282           lgamma            61.5             5.629             [2]
283            log              1.0               < 1
284           log10             3.5              1.592
285           log1p             1.0               < 1
286            log2             1.0               < 1
287            pow              1.0               < 1
288            sin              1.0               < 1
289            sinh             4.0              2.078
290            sqrt             0.5              0.500             [1]
291            tan              1.0               < 1
292            tanh             3.5              2.136
293           tgamma            1.0               < 1
294
295
296   Double precision real functions (x86)
297                         error bound      largest error
298          function          (ulps)       observed (ulps)       notes
299            acos             1.0               < 1
300           acosh             4.0              1.694
301            asin             1.0               < 1
302           asinh             7.0              1.493
303            atan             1.0               < 1
304           atan2             1.0               < 1
305           atanh             4.0              1.445
306            cbrt             1.0               < 1
307            cos              1.0               < 1
308            cosh             3.0              1.001
309            erf              4.0              0.932
310            erfc             6.0              2.728
311            exp              1.0               < 1
312            exp2             1.0               < 1
313           expm1             1.0               < 1
314           hypot             1.0               < 1
315           lgamma            61.5             2.654             [2]
316            log              1.0               < 1
317           log10             1.0               < 1
318           log1p             1.0               < 1
319            log2             1.0               < 1
320            pow              1.0               < 1
321            sin              1.0               < 1
322            sinh             4.0              1.458
323            sqrt            0.5003            0.500             [1]
324            tan              1.0               < 1
325            tanh             3.5              1.592
326           tgamma            1.0               < 1
327
328
329   Quadruple precision real functions (SPARC)
330                         error bound      largest error
331
332          function          (ulps)       observed (ulps)       notes
333           acosl             3.5              1.771
334           acoshl            8.0              1.275
335           asinl             4.0              2.007
336           asinhl            9.0              1.823
337           atanl             1.0               < 1
338           atan2l            2.5              1.102
339           atanhl            4.0              1.970
340           cbrtl             1.0               < 1
341            cosl             1.0               < 1
342           coshl             3.5              0.985
343            erfl             2.0              0.779
344           erfcl             68.5            13.923
345            expl             1.0               < 1
346           exp2l             2.0              0.714
347           expm1l            2.0              1.020
348           hypotl            1.0               < 1
349          lgammal            18.5             2.916             [2]
350            logl             1.0               < 1
351           log10l            3.5              1.156
352           log1pl            2.0              1.216
353           log2l             3.5              1.675
354            powl             1.0               < 1
355            sinl             1.0               < 1
356           sinhl             4.5              1.589
357           sqrtl             0.5              0.500             [1]
358            tanl             4.5              2.380
359           tanhl             4.5              1.692
360          tgammal            1.0               < 1
361
362
363   Extended precision real functions (x86 and x64)
364                         error bound      largest error
365          function          (ulps)       observed (ulps)       notes
366           acosl             3.0              1.868
367           acoshl            8.0              2.352
368           asinl             3.0              1.716
369           asinhl            9.0              2.346
370           atanl             1.0               < 1
371           atan2l            1.0               < 1
372           atanhl            4.0              2.438
373           cbrtl             1.0               < 1
374            cosl             1.0               < 1
375           coshl             3.5              1.288
376            erfl             1.0               < 1
377           erfcl             78.5            13.407
378            expl             3.5              1.291
379           exp2l             1.5              0.807
380           expm1l            4.0              1.936
381           hypotl            3.5              2.087
382          lgammal            22.5             4.197             [2]
383            logl             2.0              0.881
384           log10l            2.0              1.284
385           log1pl            5.0              2.370
386           log2l             1.0               < 1
387            powl           32770.0          4478.132
388            sinl             1.0               < 1
389           sinhl             4.5              2.356
390           sqrtl             0.5              0.500             [1]
391            tanl             4.5              2.366
392           tanhl             4.5              2.417
393          tgammal            1.0               < 1
394
395
396   Notes:
397       [1]    On SPARC and x64, sqrtf, sqrt, and sqrtl are  correctly  rounded
398              in accordance with IEEE 754. On x86, sqrtl is correctly rounded,
399              sqrtf is correctly rounded provided the result  is  narrowed  to
400              single  precision as discussed above, but sqrt might not be cor‐
401              rectly rounded due to "double rounding": when  the  intermediate
402              value  computed  to  extended  precision  lies  exactly  halfway
403              between two  representable  numbers  in  double  precision,  the
404              result of rounding the intermediate value to double precision is
405              determined by the round-ties-to-even rule. If this  rule  causes
406              the second rounding to round in the same direction as the first,
407              the net rounding error  can  exceed  0.5  ulps.  (The  error  is
408              bounded instead by 0.5*(1 + 2^-11) ulps.)
409
410
411       [2]    Error  bounds  for  lgamma  and  lgammal apply only for positive
412              arguments.
413
414
415   Complex functions
416       The real-valued complex functions cabsf, cabs, cabsl, cargf, carg,  and
417       cargl  are  equivalent  to  the  real  functions hypotf, hypot, hypotl,
418       atan2f, atan2, and atan2l, respectively. The error bounds and  observed
419       errors given above for the latter functions also apply to the former.
420
421
422       The  complex  functions listed below are complex-valued. For each func‐
423       tion, the error bound shown applies separately to  both  the  real  and
424       imaginary  parts  of the result. (For example, both the real and imagi‐
425       nary parts of cacosf(z) are accurate to  within  1  ulp  regardless  of
426       their  magnitudes.)  Similarly, the largest observed error shown is the
427       largest error found in either the real or the  imaginary  part  of  the
428       result.
429
430   Single precision complex functions (SPARC and x64)
431                          error bound      largest error
432          function           (ulps)       observed (ulps)       notes
433       cacosf, cacoshf         1                < 1              [1]
434       casinf, casinhf         1                < 1
435       catanf, catanhf         6                < 1
436        ccosf, ccoshf          10              2.012
437            cexpf              3               2.239
438            clogf              3                < 1
439            cpowf              —                < 1              [2]
440        csinf, csinhf          10              2.009
441           csqrtf              4                < 1
442        ctanf, ctanhf          13              6.987
443
444
445   Single precision complex functions (x86)
446                          error bound      largest error
447          function           (ulps)       observed (ulps)       notes
448       cacosf, cacoshf         1                < 1              [1]
449       casinf, casinhf         1                < 1
450       catanf, catanhf         6                < 1
451        ccosf, ccoshf          10              1.984
452            cexpf              3               1.984
453            clogf              3                < 1
454            cpowf              —                < 1              [2]
455        csinf, csinhf          10              1.973
456           csqrtf              4                < 1
457        ctanf, ctanhf          13              4.657
458
459
460   Double precision complex functions (SPARC and x64)
461                         error bound      largest error
462          function          (ulps)       observed (ulps)       notes
463       cacos, cacosh          9               3.831             [1]
464       casin, casinh          9               3.732
465       catan, catanh          6               4.179
466        ccos, ccosh           10              3.832
467
468            cexp              3               2.255
469            clog              3               2.870
470            cpow              -                 -               [2]
471        csin, csinh           10              3.722
472           csqrt              4               3.204
473        ctan, ctanh           13              7.143
474
475
476   Double precision complex functions (x86)
477                         error bound      largest error
478          function          (ulps)       observed (ulps)       notes
479       cacos, cacosh          9               3.624             [1]
480       casin, casinh          9               3.624
481       catan, catanh          6               2.500
482        ccos, ccosh           10              2.929
483            cexp              3               2.147
484            clog              3               1.927
485            cpow              -                 -               [2]
486        csin, csinh           10              2.918
487           csqrt              4               1.914
488        ctan, ctanh           13              4.630
489
490
491   Quadruple precision complex functions (SPARC)
492                          error bound      largest error
493          function           (ulps)       observed (ulps)       notes
494       cacosl, cacoshl         9                 3               [1]
495       casinl, casinhl         9                 3
496       catanl, catanhl         6                 3
497        ccosl, ccoshl          10                3
498            cexpl              3                 2
499            clogl              3                 2
500            cpowl              -                 -               [2]
501        csinl, csinhl          10                3
502           csqrtl              4                 3
503        ctanl, ctanhl          13                5
504
505
506   Extended precision complex functions (x86 and x64)
507                          error bound      largest error
508          function           (ulps)       observed (ulps)       notes
509       cacosl, cacoshl         9                 2               [1]
510       casinl, casinhl         9                 2
511       catanl, catanhl         6                 2
512        ccosl, ccoshl          10                3
513            cexpl              3               2.699
514            clogl              3                 1
515            cpowl              -                 -               [2]
516        csinl, csinhl          10                3
517           csqrtl              4               1.452
518        ctanl, ctanhl          13                5
519
520
521   Notes:
522       [1]    The complex hyperbolic trigonometric functions are equivalent by
523              symmetries to their circular trigonometric counterparts. Because
524              the implementations of these functions exploit these symmetries,
525              corresponding functions have the same error bounds and  observed
526              errors.
527
528
529       [2]    For  large  arguments,  the results computed by cpowf, cpow, and
530              cpowl can have unbounded relative error. It might be possible to
531              give  error  bounds for specific domains, but no such bounds are
532              currently available. The  observed  errors  shown  are  for  the
533              domain {(z,w) : max(|Re z|, |Im z|, |Re w|, |Im w|) <= 1}.
534
535

FILES

537       /lib/libm.so.2       shared object
538
539
540       /lib/64/libm.so.2    64-bit shared object
541
542

ATTRIBUTES

544       See attributes(5) for descriptions of the following attributes:
545
546
547
548
549       ┌─────────────────────────────┬─────────────────────────────┐
550       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
551       ├─────────────────────────────┼─────────────────────────────┤
552       │Availability                 │SUNWlibmsr                   │
553       │MT-Level                     │Safe with exceptions         │
554       └─────────────────────────────┴─────────────────────────────┘
555
556
557       As  described  on  the lgamma(3M) manual page, gamma() and lgamma() and
558       their float and long double counterparts are Unsafe.  All  other  func‐
559       tions in libm.so.2 are MT-Safe.
560

SEE ALSO

562       Intro(3), lgamma(3M), math.h(3HEAD), attributes(5), standards(5)
563
564
565
566SunOS 5.11                        12 Jul 2006                       libm(3LIB)
Impressum