1 libm(3LIB)                    Interface Libraries                   libm(3LIB)
   2 
   3 
   4 
   5 NAME
   6        libm - C math library
   7 
   8 SYNOPSIS
   9        c99 [ flag... ] file... -lm [ library... ]
  10 
  11 
  12 DESCRIPTION
  13        Functions in this library provide common elementary mathematical
  14        functions and floating point environment routines defined by System V,
  15        ANSI C, POSIX, and so on. See standards(5). Additional functions in
  16        this library provide extended support for handling floating point
  17        exceptions.
  18 
  19 INTERFACES
  20        The shared object libm.so.2 provides the public interfaces defined
  21        below.  See Intro(3) for additional information on shared object
  22        interfaces.
  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        cpow                          cpowf
  67        cpowl                         cproj
  68        cprojf                        cprojl
  69        creal                         crealf
  70        creall                        csin
  71        csinf                         csinh
  72        csinhf                        csinhl
  73        csinl                         csqrt
  74        csqrtf                        csqrtl
  75        ctan                          ctanf
  76        ctanh                         ctanhf
  77        ctanhl                        ctanl
  78        erf                           erfc
  79        erfcf                         erfcl
  80        erff                          erfl
  81        exp                           exp2
  82        exp2f                         exp2l
  83        expf                          expl
  84        expm1                         expm1f
  85        expm1l                        fabs
  86        fabsf                         fabsl
  87        fdim                          fdimf
  88        fdiml                         feclearexcept
  89        fegetenv                      fegetexceptflag
  90        fegetround                    feholdexcept
  91        feraiseexcept                 fesetenv
  92        fesetexceptflag               fesetround
  93        fetestexcept                  feupdateenv
  94        fex_get_handling              fex_get_log
  95        fex_get_log_depth             fex_getexcepthandler
  96        fex_log_entry                 fex_merge_flags
  97        fex_set_handling              fex_set_log
  98        fex_set_log_depth             fex_setexcepthandler
  99        floor                         floorf
 100        floorl                        fma
 101        fmaf                          fmal
 102        fmax                          fmaxf
 103        fmaxl                         fmin
 104        fminf                         fminl
 105        fmod                          fmodf
 106        fmodl                         frexp
 107        frexpf                        frexpl
 108        gamma                         gamma_r
 109        gammaf                        gammaf_r
 110        gammal                        gammal_r
 111        hypot                         hypotf
 112        hypotl                        ilogb
 113        ilogbf                        ilogbl
 114        isnan                         j0
 115        j0f                           j0l
 116        j1                            j1f
 117        j1l                           jn
 118        jnf                           jnl
 119        ldexp                         ldexpf
 120        ldexpl                        lgamma
 121        lgamma_r                      lgammaf
 122        lgammaf_r                     lgammal
 123        lgammal_r                     llrint
 124        llrintf                       llrintl
 125        llround                       llroundf
 126        llroundl                      log
 127        log10                         log10f
 128        log10l                        log1p
 129        log1pf                        log1pl
 130        log2                          log2f
 131        log2l                         logb
 132        logbf                         logbl
 133        logf                          logl
 134        lrint                         lrintf
 135        lrintl                        lround
 136        lroundf                       lroundl
 137        matherr                       modf
 138        modff                         modfl
 139        nan                           nanf
 140        nanl                          nearbyint
 141        nearbyintf                    nearbyintl
 142        nextafter                     nextafterf
 143        nextafterl                    nexttoward
 144        nexttowardf                   nexttowardl
 145        pow                           powf
 146        powl                          remainder
 147        remainderf                    remainderl
 148        remquo                        remquof
 149        remquol                       rint
 150        rintf                         rintl
 151        round                         roundf
 152        roundl                        scalb
 153        scalbf                        scalbl
 154        scalbln                       scalblnf
 155        scalblnl                      scalbn
 156        scalbnf                       scalbnl
 157        signgam                       signgamf
 158        signgaml                      significand
 159        significandf                  significandl
 160        sin                           sincos
 161        sincosf                       sincosl
 162        sinf                          sinh
 163        sinhf                         sinhl
 164        sinl                          sqrt
 165        sqrtf                         sqrtl
 166        tan                           tanf
 167        tanh                          tanhf
 168        tanhl                         tanl
 169        tgamma                        tgammaf
 170        tgammal                       trunc
 171        truncf                        truncl
 172        y0                            y0f
 173        y0l                           y1
 174        y1f                           y1l
 175        yn                            ynf
 176        ynl
 177 
 178 
 179 
 180        The following interfaces are unique to the x86 and amd64 versions of
 181        this library:
 182 
 183 
 184 
 185 
 186        fegetprec                     fesetprec
 187 
 188 
 189 ACCURACY
 190        ISO/IEC 9899:1999, also known as C99, specifies the functions listed in
 191        the following tables and states that the accuracy of these functions is
 192        "implementation-defined". The information below characterizes the
 193        accuracy of these functions as implemented in libm.so.2. For each
 194        function, the tables provide an upper bound on the largest error
 195        possible for any argument and the largest error actually observed among
 196        a large sample of arguments. Errors are expressed in "units in the last
 197        place", or ulps, relative to the exact function value for each argument
 198        (regarding the argument as exact). Ulps depend on the precision of the
 199        floating point format: if y is the exact function value, x and x' are
 200        adjacent floating point numbers such that x < y < x', and x'' is   the
 201        computed function value, then provided x, x', and x'' all lie in the
 202        same binade, the error in x'' is |y - x''| / |x - x'| ulps. In
 203        particular, when the error is less than one ulp, the computed value is
 204        one of the two floating point numbers adjacent to the exact value.
 205 
 206 
 207        The bounds and observed errors listed below apply only in the default
 208        floating point modes. Specifically, on SPARC, these bounds assume the
 209        rounding direction is round-to-nearest and non-standard mode is
 210        disabled. On x86, the bounds assume the rounding direction is round-to-
 211        nearest and the rounding precision is round-to-64-bits. Moreover, on
 212        x86, floating point function values are returned in a floating point
 213        register in extended double precision format, but the bounds below
 214        assume that the result value is then stored to memory in the format
 215        corresponding to the function's type. On amd64, the bounds assume the
 216        rounding direction in both the x87 floating point control word and the
 217        MXCSR is round-to-nearest, the rounding precision in the x87 control
 218        word is round-to-64-bits, and the FTZ and DAZ modes are disabled.
 219 
 220 
 221        The error bounds listed below are believed to be correct, but smaller
 222        bounds might be proved later. The observed errors are the largest ones
 223        currently known, but larger errors might be discovered later. Numbers
 224        in the notes column refer to the notes following the tables.
 225 
 226    Real Functions
 227    Single precision real functions (SPARC, x86, and amd64)
 228 
 229                          error bound      largest error
 230           function          (ulps)       observed (ulps)       notes
 231            acosf             1.0               < 1
 232            acoshf            1.0               < 1
 233            asinf             1.0               < 1
 234            asinhf            1.0               < 1
 235            atanf             1.0               < 1
 236            atan2f            1.0               < 1
 237            atanhf            1.0               < 1
 238            cbrtf             1.0               < 1
 239             cosf             1.0               < 1
 240            coshf             1.0               < 1
 241             erff             1.0               < 1
 242            erfcf             1.0               < 1
 243             expf             1.0               < 1
 244            exp2f             1.0               < 1
 245            expm1f            1.0               < 1
 246            hypotf            1.0               < 1
 247           lgammaf            1.0               < 1
 248             logf             1.0               < 1
 249            log10f            1.0               < 1
 250            log1pf            1.0               < 1
 251            log2f             1.0               < 1
 252             powf             1.0               < 1
 253             sinf             1.0               < 1
 254            sinhf             1.0               < 1
 255            sqrtf             0.5              0.500             [1]
 256             tanf             1.0               < 1
 257            tanhf             1.0               < 1
 258           tgammaf            1.0               < 1
 259 
 260 
 261    Double precision real functions (SPARC and amd64)
 262 
 263                          error bound      largest error
 264           function          (ulps)       observed (ulps)       notes
 265             acos             1.0               < 1
 266            acosh             4.0              1.878
 267             asin             1.0               < 1
 268            asinh             7.0              1.653
 269             atan             1.0               <1
 270            atan2             2.5              1.475
 271            atanh             4.0              1.960
 272             cbrt             1.0               < 1
 273             cos              1.0               < 1
 274             cosh             3.0              1.168
 275             erf              4.0              0.959
 276             erfc             6.0              2.816
 277             exp              1.0               < 1
 278             exp2             2.0              1.050
 279            expm1             1.0               < 1
 280            hypot             1.0               < 1
 281            lgamma            61.5             5.629             [2]
 282             log              1.0               < 1
 283            log10             3.5              1.592
 284            log1p             1.0               < 1
 285             log2             1.0               < 1
 286             pow              1.0               < 1
 287             sin              1.0               < 1
 288             sinh             4.0              2.078
 289             sqrt             0.5              0.500             [1]
 290             tan              1.0               < 1
 291             tanh             3.5              2.136
 292            tgamma            1.0               < 1
 293 
 294 
 295    Double precision real functions (x86)
 296 
 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 
 331                          error bound      largest error
 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 amd64)
 364 
 365                          error bound      largest error
 366           function          (ulps)       observed (ulps)       notes
 367            acosl             3.0              1.868
 368            acoshl            8.0              2.352
 369            asinl             3.0              1.716
 370            asinhl            9.0              2.346
 371            atanl             1.0               < 1
 372            atan2l            1.0               < 1
 373            atanhl            4.0              2.438
 374            cbrtl             1.0               < 1
 375             cosl             1.0               < 1
 376            coshl             3.5              1.288
 377             erfl             1.0               < 1
 378            erfcl             78.5            13.407
 379             expl             3.5              1.291
 380            exp2l             1.5              0.807
 381            expm1l            4.0              1.936
 382            hypotl            3.5              2.087
 383           lgammal            22.5             4.197             [2]
 384             logl             2.0              0.881
 385            log10l            2.0              1.284
 386            log1pl            5.0              2.370
 387            log2l             1.0               < 1
 388             powl           32770.0          4478.132
 389             sinl             1.0               < 1
 390            sinhl             4.5              2.356
 391            sqrtl             0.5              0.500             [1]
 392             tanl             4.5              2.366
 393            tanhl             4.5              2.417
 394           tgammal            1.0               < 1
 395 
 396 
 397    Notes:
 398        [1]
 399               On SPARC and amd64, sqrtf, sqrt, and sqrtl are correctly rounded
 400               in accordance with IEEE 754. On x86, sqrtl is correctly rounded,
 401               sqrtf is correctly rounded provided the result is narrowed to
 402               single precision as discussed above, but sqrt might not be
 403               correctly rounded due to "double rounding": when the
 404               intermediate value computed to extended precision lies exactly
 405               halfway between two representable numbers in double precision,
 406               the result of rounding the intermediate value to double
 407               precision is determined by the round-ties-to-even rule. If this
 408               rule causes the second rounding to round in the same direction
 409               as the first, the net rounding error can exceed 0.5 ulps.  (The
 410               error is bounded instead by 0.5*(1 + 2^-11) ulps.)
 411 
 412 
 413        [2]
 414               Error bounds for lgamma and lgammal apply only for positive
 415               arguments.
 416 
 417 
 418    Complex functions
 419        The real-valued complex functions cabsf, cabs, cabsl, cargf, carg, and
 420        cargl are equivalent to the real functions hypotf, hypot, hypotl,
 421        atan2f, atan2, and atan2l, respectively. The error bounds and observed
 422        errors given above for the latter functions also apply to the former.
 423 
 424 
 425        The complex functions listed below are complex-valued. For each
 426        function, the error bound shown applies separately to both the real and
 427        imaginary parts of the result. (For example, both the real and
 428        imaginary parts of cacosf(z) are accurate to within 1 ulp regardless of
 429        their magnitudes.) Similarly, the largest observed error shown is the
 430        largest error found in either the real or the imaginary part of the
 431        result.
 432 
 433    Single precision complex functions (SPARC and amd64)
 434 
 435                           error bound      largest error
 436           function           (ulps)       observed (ulps)       notes
 437        cacosf, cacoshf         1                < 1           [1]
 438        casinf, casinhf         1                < 1
 439        catanf, catanhf         6                < 1
 440         ccosf, ccoshf          10              2.012
 441             cexpf              3               2.239
 442             clogf              3                < 1
 443             cpowf              --               < 1           [2]
 444         csinf, csinhf          10              2.009
 445            csqrtf              4                < 1
 446         ctanf, ctanhf          13              6.987
 447 
 448 
 449    Single precision complex functions (x86)
 450 
 451                           error bound      largest error
 452           function           (ulps)       observed (ulps)       notes
 453        cacosf, cacoshf         1                < 1           [1]
 454        casinf, casinhf         1                < 1
 455        catanf, catanhf         6                < 1
 456         ccosf, ccoshf          10              1.984
 457             cexpf              3               1.984
 458             clogf              3                < 1
 459             cpowf              --               < 1           [2]
 460         csinf, csinhf          10              1.973
 461            csqrtf              4                < 1
 462         ctanf, ctanhf          13              4.657
 463 
 464 
 465    Double precision complex functions (SPARC and amd64)
 466 
 467                          error bound      largest error
 468           function          (ulps)       observed (ulps)       notes
 469        cacos, cacosh          9               3.831             [1]
 470        casin, casinh          9               3.732
 471        catan, catanh          6               4.179
 472         ccos, ccosh           10              3.832
 473             cexp              3               2.255
 474             clog              3               2.870
 475             cpow              -                 -               [2]
 476         csin, csinh           10              3.722
 477            csqrt              4               3.204
 478         ctan, ctanh           13              7.143
 479 
 480 
 481    Double precision complex functions (x86)
 482 
 483                          error bound      largest error
 484           function          (ulps)       observed (ulps)       notes
 485        cacos, cacosh          9               3.624             [1]
 486        casin, casinh          9               3.624
 487        catan, catanh          6               2.500
 488         ccos, ccosh           10              2.929
 489             cexp              3               2.147
 490             clog              3               1.927
 491             cpow              -                 -               [2]
 492         csin, csinh           10              2.918
 493            csqrt              4               1.914
 494         ctan, ctanh           13              4.630
 495 
 496 
 497    Quadruple precision complex functions (SPARC)
 498 
 499                           error bound      largest error
 500           function           (ulps)       observed (ulps)       notes
 501        cacosl, cacoshl         9                 3               [1]
 502        casinl, casinhl         9                 3
 503        catanl, catanhl         6                 3
 504         ccosl, ccoshl          10                3
 505             cexpl              3                 2
 506             clogl              3                 2
 507             cpowl              -                 -               [2]
 508         csinl, csinhl          10                3
 509            csqrtl              4                 3
 510         ctanl, ctanhl          13                5
 511 
 512 
 513    Extended precision complex functions (x86 and amd64)
 514 
 515                           error bound      largest error
 516           function           (ulps)       observed (ulps)       notes
 517        cacosl, cacoshl         9                 2               [1]
 518        casinl, casinhl         9                 2
 519        catanl, catanhl         6                 2
 520         ccosl, ccoshl          10                3
 521             cexpl              3               2.699
 522             clogl              3                 1
 523             cpowl              -                 -               [2]
 524         csinl, csinhl          10                3
 525            csqrtl              4               1.452
 526         ctanl, ctanhl          13                5
 527 
 528 
 529    Notes:
 530        [1]
 531               The complex hyperbolic trigonometric functions are equivalent by
 532               symmetries to their circular trigonometric counterparts. Because
 533               the implementations of these functions exploit these symmetries,
 534               corresponding functions have the same error bounds and observed
 535               errors.
 536 
 537 
 538        [2]
 539               For large arguments, the results computed by cpowf, cpow, and
 540               cpowl can have unbounded relative error. It might be possible to
 541               give error bounds for specific domains, but no such bounds are
 542               currently available.  The observed errors shown are for the
 543               domain {(z,w) : max(|Re z|, |Im z|, |Re w|, |Im w|) <= 1}.
 544 
 545 
 546 FILES
 547        /lib/libm.so.2
 548                             shared object
 549 
 550 
 551        /lib/64/libm.so.2
 552                             64-bit shared object
 553 
 554 
 555 ATTRIBUTES
 556        See attributes(5) for descriptions of the following attributes:
 557 
 558 
 559 
 560 
 561        +----------------------------+-----------------------------+
 562        |      ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
 563        +----------------------------+-----------------------------+
 564        |MT-Level                    | Safe with exceptions        |
 565        +----------------------------+-----------------------------+
 566 
 567 
 568        As described on the lgamma(3M) manual page, gamma() and lgamma() and
 569        their float and long double counterparts are Unsafe. All other
 570        functions in libm.so.2 are MT-Safe.
 571 
 572 SEE ALSO
 573        Intro(3), lgamma(3M), math.h(3HEAD), attributes(5), standards(5)
 574 
 575 
 576 
 577                                February 27, 2020                    libm(3LIB)