1 /* origin: FreeBSD /usr/src/lib/msun/src/s_sin.c */
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6 * Developed at SunPro, a Sun Microsystems, Inc. business.
7 * Permission to use, copy, modify, and distribute this
8 * software is freely granted, provided that this notice
10 * ====================================================
13 use super::{get_high_word, k_cos, k_sin, rem_pio2}
;
15 pub fn sincos(x
: f64) -> (f64, f64) {
20 ix
= get_high_word(x
);
25 /* if |x| < 2**-27 * sqrt(2) */
27 /* raise inexact if x!=0 and underflow if subnormal */
28 let x1p120
= f64::from_bits(0x4770000000000000); // 0x1p120 == 2^120
30 force_eval
!(x
/ x1p120
);
32 force_eval
!(x
+ x1p120
);
36 return (k_sin(x
, 0.0, 0), k_cos(x
, 0.0));
39 /* sincos(Inf or NaN) is NaN */
45 /* argument reduction needed */
46 let (n
, y0
, y1
) = rem_pio2(x
);
54 #[cfg(feature = "checked")]
56 #[cfg(not(feature = "checked"))]