OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libquadmath/] [math/] [asinhq.c] - Blame information for rev 740

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 740 jeremybenn
/* s_asinhl.c -- long double version of s_asinh.c.
2
 * Conversion to long double by Ulrich Drepper,
3
 * Cygnus Support, drepper@cygnus.com.
4
 */
5
 
6
/*
7
 * ====================================================
8
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
9
 *
10
 * Developed at SunPro, a Sun Microsystems, Inc. business.
11
 * Permission to use, copy, modify, and distribute this
12
 * software is freely granted, provided that this notice
13
 * is preserved.
14
 * ====================================================
15
 */
16
 
17
/* asinhl(x)
18
 * Method :
19
 *      Based on
20
 *              asinhl(x) = signl(x) * logl [ |x| + sqrtl(x*x+1) ]
21
 *      we have
22
 *      asinhl(x) := x  if  1+x*x=1,
23
 *                := signl(x)*(logl(x)+ln2)) for large |x|, else
24
 *                := signl(x)*logl(2|x|+1/(|x|+sqrtl(x*x+1))) if|x|>2, else
25
 *                := signl(x)*log1pl(|x| + x^2/(1 + sqrtl(1+x^2)))
26
 */
27
 
28
#include "quadmath-imp.h"
29
 
30
static const __float128
31
  one = 1.0Q,
32
  ln2 = 6.931471805599453094172321214581765681e-1Q,
33
  huge = 1.0e+4900Q;
34
 
35
__float128
36
asinhq (__float128 x)
37
{
38
  __float128 t, w;
39
  int32_t ix, sign;
40
  ieee854_float128 u;
41
 
42
  u.value = x;
43
  sign = u.words32.w0;
44
  ix = sign & 0x7fffffff;
45
  if (ix == 0x7fff0000)
46
    return x + x;               /* x is inf or NaN */
47
  if (ix < 0x3fc70000)
48
    {                           /* |x| < 2^ -56 */
49
      if (huge + x > one)
50
        return x;               /* return x inexact except 0 */
51
    }
52
  u.words32.w0 = ix;
53
  if (ix > 0x40350000)
54
    {                           /* |x| > 2 ^ 54 */
55
      w = logq (u.value) + ln2;
56
    }
57
  else if (ix >0x40000000)
58
    {                           /* 2^ 54 > |x| > 2.0 */
59
      t = u.value;
60
      w = logq (2.0 * t + one / (sqrtq (x * x + one) + t));
61
    }
62
  else
63
    {                           /* 2.0 > |x| > 2 ^ -56 */
64
      t = x * x;
65
      w = log1pq (u.value + t / (one + sqrtq (one + t)));
66
    }
67
  if (sign & 0x80000000)
68
    return -w;
69
  else
70
    return w;
71
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.