Mercurial > hg > octave-jordi > gnulib-hg
annotate lib/asinl.c @ 18029:e4a13d95b503
mgetgroups: port to strict OS X
* doc/glibc-functions/getgrouplist.texi (getgrouplist):
Document the getgrouplist problem.
* lib/mgetgroups.c (getgrouplist_gids) [HAVE_GETGROUPLIST]:
New macro.
(mgetgroups): Use it.
* m4/mgetgroups.m4 (gl_MGETGROUPS):
Check for OS X signature for getgrouplist.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sun, 28 Jun 2015 23:43:35 -0700 |
parents | 2074f2bf7216 |
children |
rev | line source |
---|---|
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1 /* |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
2 * ==================================================== |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
4 * |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
5 * Developed at SunPro, a Sun Microsystems, Inc. business. |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
6 * Permission to use, copy, modify, and distribute this |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
7 * software is freely granted, provided that this notice |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8 * is preserved. |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
9 * ==================================================== |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
10 */ |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
11 |
8186
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
4652
diff
changeset
|
12 #include <config.h> |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
4652
diff
changeset
|
13 |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
4652
diff
changeset
|
14 /* Specification. */ |
c115624bf99a
New module 'math'. <math.h> replaces mathl.h.
Bruno Haible <bruno@clisp.org>
parents:
4652
diff
changeset
|
15 #include <math.h> |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
16 |
15942
cfc88a2774f7
asinl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents:
13051
diff
changeset
|
17 #if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE |
cfc88a2774f7
asinl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents:
13051
diff
changeset
|
18 |
cfc88a2774f7
asinl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents:
13051
diff
changeset
|
19 long double |
cfc88a2774f7
asinl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents:
13051
diff
changeset
|
20 asinl (long double x) |
cfc88a2774f7
asinl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents:
13051
diff
changeset
|
21 { |
cfc88a2774f7
asinl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents:
13051
diff
changeset
|
22 return asin (x); |
cfc88a2774f7
asinl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents:
13051
diff
changeset
|
23 } |
cfc88a2774f7
asinl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents:
13051
diff
changeset
|
24 |
cfc88a2774f7
asinl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents:
13051
diff
changeset
|
25 #else |
cfc88a2774f7
asinl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents:
13051
diff
changeset
|
26 |
16511 | 27 /* Code based on glibc/sysdeps/ieee754/ldbl-128/e_asinl.c. */ |
28 | |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
29 /* |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
30 Long double expansions contributed by |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
31 Stephen L. Moshier <moshier@na-net.ornl.gov> |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
32 */ |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
33 |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
34 /* asin(x) |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
35 * Method : |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
36 * Since asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ... |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
37 * we approximate asin(x) on [0,0.5] by |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
38 * asin(x) = x + x*x^2*R(x^2) |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
39 * Between .5 and .625 the approximation is |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
40 * asin(0.5625 + x) = asin(0.5625) + x rS(x) / sS(x) |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
41 * For x in [0.625,1] |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
42 * asin(x) = pi/2-2*asin(sqrt((1-x)/2)) |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
43 * |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
44 * Special cases: |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
45 * if x is NaN, return x itself; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
46 * if |x|>1, return NaN with invalid signal. |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
47 * |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
48 */ |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
49 |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
50 |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
51 static const long double |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
52 one = 1.0L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
53 huge = 1.0e+4932L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
54 pio2_hi = 1.5707963267948966192313216916397514420986L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
55 pio2_lo = 4.3359050650618905123985220130216759843812E-35L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
56 pio4_hi = 7.8539816339744830961566084581987569936977E-1L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
57 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
58 /* coefficient for R(x^2) */ |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
59 |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
60 /* asin(x) = x + x^3 pS(x^2) / qS(x^2) |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
61 0 <= x <= 0.5 |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
62 peak relative error 1.9e-35 */ |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
63 pS0 = -8.358099012470680544198472400254596543711E2L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
64 pS1 = 3.674973957689619490312782828051860366493E3L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
65 pS2 = -6.730729094812979665807581609853656623219E3L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
66 pS3 = 6.643843795209060298375552684423454077633E3L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
67 pS4 = -3.817341990928606692235481812252049415993E3L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
68 pS5 = 1.284635388402653715636722822195716476156E3L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
69 pS6 = -2.410736125231549204856567737329112037867E2L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
70 pS7 = 2.219191969382402856557594215833622156220E1L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
71 pS8 = -7.249056260830627156600112195061001036533E-1L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
72 pS9 = 1.055923570937755300061509030361395604448E-3L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
73 |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
74 qS0 = -5.014859407482408326519083440151745519205E3L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
75 qS1 = 2.430653047950480068881028451580393430537E4L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
76 qS2 = -4.997904737193653607449250593976069726962E4L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
77 qS3 = 5.675712336110456923807959930107347511086E4L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
78 qS4 = -3.881523118339661268482937768522572588022E4L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
79 qS5 = 1.634202194895541569749717032234510811216E4L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
80 qS6 = -4.151452662440709301601820849901296953752E3L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
81 qS7 = 5.956050864057192019085175976175695342168E2L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
82 qS8 = -4.175375777334867025769346564600396877176E1L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
83 /* 1.000000000000000000000000000000000000000E0 */ |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
84 |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
85 /* asin(0.5625 + x) = asin(0.5625) + x rS(x) / sS(x) |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
86 -0.0625 <= x <= 0.0625 |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
87 peak relative error 3.3e-35 */ |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
88 rS0 = -5.619049346208901520945464704848780243887E0L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
89 rS1 = 4.460504162777731472539175700169871920352E1L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
90 rS2 = -1.317669505315409261479577040530751477488E2L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
91 rS3 = 1.626532582423661989632442410808596009227E2L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
92 rS4 = -3.144806644195158614904369445440583873264E1L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
93 rS5 = -9.806674443470740708765165604769099559553E1L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
94 rS6 = 5.708468492052010816555762842394927806920E1L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
95 rS7 = 1.396540499232262112248553357962639431922E1L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
96 rS8 = -1.126243289311910363001762058295832610344E1L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
97 rS9 = -4.956179821329901954211277873774472383512E-1L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
98 rS10 = 3.313227657082367169241333738391762525780E-1L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
99 |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
100 sS0 = -4.645814742084009935700221277307007679325E0L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
101 sS1 = 3.879074822457694323970438316317961918430E1L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
102 sS2 = -1.221986588013474694623973554726201001066E2L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
103 sS3 = 1.658821150347718105012079876756201905822E2L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
104 sS4 = -4.804379630977558197953176474426239748977E1L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
105 sS5 = -1.004296417397316948114344573811562952793E2L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
106 sS6 = 7.530281592861320234941101403870010111138E1L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
107 sS7 = 1.270735595411673647119592092304357226607E1L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
108 sS8 = -1.815144839646376500705105967064792930282E1L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
109 sS9 = -7.821597334910963922204235247786840828217E-2L, |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
110 /* 1.000000000000000000000000000000000000000E0 */ |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
111 |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
112 asinr5625 = 5.9740641664535021430381036628424864397707E-1L; |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
113 |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
114 |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
115 long double |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
116 asinl (long double x) |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
117 { |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
118 long double y, t, p, q; |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
119 int sign; |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
120 |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
121 sign = 1; |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
122 y = x; |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
123 if (x < 0.0L) |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
124 { |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
125 sign = -1; |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
126 y = -x; |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
127 } |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
128 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
129 if (y >= 1.0L) /* |x|>= 1 */ |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
130 { |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
131 if (y == 1.0L) |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
132 /* asin(1)=+-pi/2 with inexact */ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
133 return x * pio2_hi + x * pio2_lo; |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
134 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
135 return (x - x) / (x - x); /* asin(|x|>1) is NaN */ |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
136 } |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
137 else if (y < 0.5L) /* |x| < 0.5 */ |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
138 { |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
139 if (y < 0.000000000000000006938893903907228377647697925567626953125L) /* |x| < 2**-57 */ |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
140 if (huge + y > one) |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
141 return y; /* return x with inexact if x!=0 */ |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
142 |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
143 t = x * x; |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
144 p = (((((((((pS9 * t |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
145 + pS8) * t |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
146 + pS7) * t |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
147 + pS6) * t |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
148 + pS5) * t |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
149 + pS4) * t |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
150 + pS3) * t |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
151 + pS2) * t |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
152 + pS1) * t |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
153 + pS0) * t; |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
154 |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
155 q = (((((((( t |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
156 + qS8) * t |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
157 + qS7) * t |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
158 + qS6) * t |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
159 + qS5) * t |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
160 + qS4) * t |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
161 + qS3) * t |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
162 + qS2) * t |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
163 + qS1) * t |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
164 + qS0; |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
165 |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
166 return x + x * (p / q); |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
167 } |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
168 |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
169 else if (y < 0.625) /* 0.625 */ |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
170 { |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
171 t = y - 0.5625; |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
172 p = ((((((((((rS10 * t |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
173 + rS9) * t |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
174 + rS8) * t |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
175 + rS7) * t |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
176 + rS6) * t |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
177 + rS5) * t |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
178 + rS4) * t |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
179 + rS3) * t |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
180 + rS2) * t |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
181 + rS1) * t |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
182 + rS0) * t; |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
183 |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
184 q = ((((((((( t |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
185 + sS9) * t |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
186 + sS8) * t |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
187 + sS7) * t |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
188 + sS6) * t |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
189 + sS5) * t |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
190 + sS4) * t |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
191 + sS3) * t |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
192 + sS2) * t |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
193 + sS1) * t |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
8186
diff
changeset
|
194 + sS0; |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
195 t = asinr5625 + p / q; |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
196 } |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
197 else |
13051 | 198 t = pio2_hi + pio2_lo - 2 * asinl (sqrtl ((1 - y) / 2)); |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
199 |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
200 return t * sign; |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
201 } |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
202 |
15942
cfc88a2774f7
asinl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents:
13051
diff
changeset
|
203 #endif |
cfc88a2774f7
asinl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents:
13051
diff
changeset
|
204 |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
205 #if 0 |
4652 | 206 int |
207 main (void) | |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
208 { |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
209 printf ("%.18Lg %.18Lg\n", |
13051 | 210 asinl (1.0L), |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
211 1.5707963267948966192313216916397514420984L); |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
212 printf ("%.18Lg %.18Lg\n", |
13051 | 213 asinl (0.7071067811865475244008443621048490392848L), |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
214 0.7853981633974483096156608458198757210492L); |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
215 printf ("%.18Lg %.18Lg\n", |
13051 | 216 asinl (0.5L), |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
217 0.5235987755982988730771072305465838140328L); |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
218 printf ("%.18Lg %.18Lg\n", |
13051 | 219 asinl (0.3090169943749474241022934171828190588600L), |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
220 0.3141592653589793238462643383279502884196L); |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
221 printf ("%.18Lg %.18Lg\n", |
13051 | 222 asinl (-1.0L), |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
223 -1.5707963267948966192313216916397514420984L); |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
224 printf ("%.18Lg %.18Lg\n", |
13051 | 225 asinl (-0.7071067811865475244008443621048490392848L), |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
226 -0.7853981633974483096156608458198757210492L); |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
227 printf ("%.18Lg %.18Lg\n", |
13051 | 228 asinl (-0.5L), |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
229 -0.5235987755982988730771072305465838140328L); |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
230 printf ("%.18Lg %.18Lg\n", |
13051 | 231 asinl (-0.3090169943749474241022934171828190588600L), |
4239
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
232 -0.3141592653589793238462643383279502884196L); |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
233 } |
b33b8603715c
Transcendental functions for 'long double', from Paolo Bonzini.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
234 #endif |