1 /* s_sincosl.c -- long double version of s_sincos.c
3 * Copyright (C) 2013 Elliot Saba
4 * Developed at the University of Washington
6 * Permission to use, copy, modify, and distribute this
7 * software is freely granted, provided that this notice
9 * ====================================================
12 #include <aros/debug.h>
16 #include "math_private.h"
17 #include "k_sincosl.h"
19 #if defined(__x86_64__)
20 #include "x86_64/ieeefp.h"
21 #elif defined(__i386__)
22 #include "i386/ieeefp.h"
25 #include "math_private.h"
26 #if LDBL_MANT_DIG == 64
27 #include "../ld80/e_rem_pio2l.h"
28 #elif LDBL_MANT_DIG == 113
29 #include "../ld128/e_rem_pio2l.h"
31 #error "Unsupported long double format"
35 sincosl(long double x
, long double *sn
, long double *cs
)
48 /* Optimize the case where x is already within range. */
51 * If x = +-0 or x is a subnormal number, then sin(x) = x and
54 if (z
.bits
.exp
== 0) {
58 __kernel_sincosl(x
, 0, 0, sn
, cs
);
62 /* If x = NaN or Inf, then sin(x) and cos(x) are NaN. */
63 if (z
.bits
.exp
== 32767) {
69 /* Range reduction. */
70 e0
= __ieee754_rem_pio2l(x
, y
);
74 __kernel_sincosl(y
[0], y
[1], 1, sn
, cs
);
77 __kernel_sincosl(y
[0], y
[1], 1, cs
, sn
);
81 __kernel_sincosl(y
[0], y
[1], 1, sn
, cs
);
86 __kernel_sincosl(y
[0], y
[1], 1, cs
, sn
);