Mercurial > hg > octave-kai > gnulib-hg
comparison lib/tanl.c @ 15941:83c276c24d2a
tanl: Simplify for platforms where 'long double' == 'double'.
* lib/tanl.c (tanl) [HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]: New alternative
implementation.
* m4/tanl.m4 (gl_FUNC_TANL): Require gl_LONG_DOUBLE_VS_DOUBLE.
Determine TANL_LIBM according to HAVE_SAME_LONG_DOUBLE_AS_DOUBLE.
* modules/tanl (Depends-on): Add tan. Update conditions.
(configure.ac): Don't compile trigl.c if
HAVE_SAME_LONG_DOUBLE_AS_DOUBLE.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Tue, 11 Oct 2011 02:57:05 +0200 |
parents | 094f6cfdb5c3 |
children | 2074f2bf7216 |
comparison
equal
deleted
inserted
replaced
15940:564c0603a942 | 15941:83c276c24d2a |
---|---|
16 | 16 |
17 #include <config.h> | 17 #include <config.h> |
18 | 18 |
19 /* Specification. */ | 19 /* Specification. */ |
20 #include <math.h> | 20 #include <math.h> |
21 | |
22 #if HAVE_SAME_LONG_DOUBLE_AS_DOUBLE | |
23 | |
24 long double | |
25 tanl (long double x) | |
26 { | |
27 return tan (x); | |
28 } | |
29 | |
30 #else | |
21 | 31 |
22 /* tanl(x) | 32 /* tanl(x) |
23 * Return tangent function of x. | 33 * Return tangent function of x. |
24 * | 34 * |
25 * kernel function: | 35 * kernel function: |
47 * | 57 * |
48 * Accuracy: | 58 * Accuracy: |
49 * TRIG(x) returns trig(x) nearly rounded | 59 * TRIG(x) returns trig(x) nearly rounded |
50 */ | 60 */ |
51 | 61 |
52 #include "trigl.h" | 62 # include "trigl.h" |
53 | 63 |
54 /* | 64 /* |
55 * ==================================================== | 65 * ==================================================== |
56 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. | 66 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. |
57 * | 67 * |
206 /* 1 -- n even, -1 -- n odd */ | 216 /* 1 -- n even, -1 -- n odd */ |
207 return kernel_tanl (y[0], y[1], 1 - ((n & 1) << 1)); | 217 return kernel_tanl (y[0], y[1], 1 - ((n & 1) << 1)); |
208 } | 218 } |
209 } | 219 } |
210 | 220 |
221 #endif | |
222 | |
211 #if 0 | 223 #if 0 |
212 int | 224 int |
213 main (void) | 225 main (void) |
214 { | 226 { |
215 printf ("%.16Lg\n", tanl (0.7853981633974483096156608458198757210492)); | 227 printf ("%.16Lg\n", tanl (0.7853981633974483096156608458198757210492)); |