1 // Sine function of numerical and symbolic arguments
19 if (car(p1
) == symbol(ADD
))
26 // Use angle sum formula for special angles.
32 sine_of_angle_sum(void)
66 if (car(p1
) == symbol(ARCSIN
)) {
79 // sine function is antisymmetric, sin(-x) = -sin(x)
89 // sin(arctan(x)) = x / sqrt(1 + x^2)
91 // see p. 173 of the CRC Handbook of Mathematical Sciences
93 if (car(p1
) == symbol(ARCTAN
)) {
100 push_rational(-1, 2);
106 // multiply by 180/pi
134 push_rational(-1, 2);
146 push_rational(-1, 2);
162 push_rational(-1, 2);
195 // check against the floating point math library
197 "f(a,x)=1+sin(float(a/360*2*pi))-float(x)+sin(a/360*2*pi)-x",
227 "f(45,sqrt(2)/2)", // 45
230 "f(135,sqrt(2)/2)", // 135
233 "f(225,-sqrt(2)/2)", // 225
236 "f(315,-sqrt(2)/2)", // 315
239 "f(-45,-sqrt(2)/2)", // -45
242 "f(-135,-sqrt(2)/2)", // -135
245 "f(-225,sqrt(2)/2)", // -225
248 "f(-315,sqrt(2)/2)", // -315
257 "f(210,-1/2)", // 210
260 "f(330,-1/2)", // 330
263 "f(-30,-1/2)", // -30
266 "f(-150,-1/2)", // -150
269 "f(-210,1/2)", // -210
272 "f(-330,1/2)", // -330
275 "f(60,sqrt(3)/2)", // 60
278 "f(120,sqrt(3)/2)", // 120
281 "f(240,-sqrt(3)/2)", // 240
284 "f(300,-sqrt(3)/2)", // 300
287 "f(-60,-sqrt(3)/2)", // -60
290 "f(-120,-sqrt(3)/2)", // -120
293 "f(-240,sqrt(3)/2)", // -240
296 "f(-300,sqrt(3)/2)", // -300
305 // check the default case
373 test(__FILE__
, s
, sizeof s
/ sizeof (char *));