Print this page




  25 /*
  26  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  27  * Use is subject to license terms.
  28  */
  29 
  30 #if defined(ELFOBJ)
  31 #pragma weak asinhl = __asinhl
  32 #endif
  33 
  34 #include "libm.h"
  35 
  36 static const long double
  37         ln2     = 6.931471805599453094172321214581765680755e-0001L,
  38         one     = 1.0L,
  39         big     = 1.0e+20L,
  40         tiny    = 1.0e-20L;
  41 
  42 long double
  43 asinhl(long double x) {
  44         long double t, w;

  45 
  46         w = fabsl(x);
  47         if (isnanl(x))
  48                 return (x + x); /* x is NaN */
  49         if (w < tiny) {
  50 #ifndef lint
  51                 volatile long double dummy = x + big;   /* inexact if x != 0 */
  52 #endif
  53                 return (x);     /* tiny x */
  54         } else if (w < big) {
  55                 t = one / w;
  56                 return (copysignl(log1pl(w + w / (t + sqrtl(one + t * t))), x));
  57         } else
  58                 return (copysignl(logl(w) + ln2, x));
  59 }


  25 /*
  26  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  27  * Use is subject to license terms.
  28  */
  29 
  30 #if defined(ELFOBJ)
  31 #pragma weak asinhl = __asinhl
  32 #endif
  33 
  34 #include "libm.h"
  35 
  36 static const long double
  37         ln2     = 6.931471805599453094172321214581765680755e-0001L,
  38         one     = 1.0L,
  39         big     = 1.0e+20L,
  40         tiny    = 1.0e-20L;
  41 
  42 long double
  43 asinhl(long double x) {
  44         long double t, w;
  45         volatile long double dummy;
  46 
  47         w = fabsl(x);
  48         if (isnanl(x))
  49                 return (x + x); /* x is NaN */
  50         if (w < tiny) {
  51 #ifndef lint
  52                 dummy = x + big;        /* inexact if x != 0 */
  53 #endif
  54                 return (x);     /* tiny x */
  55         } else if (w < big) {
  56                 t = one / w;
  57                 return (copysignl(log1pl(w + w / (t + sqrtl(one + t * t))), x));
  58         } else
  59                 return (copysignl(logl(w) + ln2, x));
  60 }