2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #include "mathieeesingtrans_intern.h"
10 Calculate the tangens of a given IEEE single precision number in radians
13 IEEE single precision floating point number
17 negative : result is negative
33 AROS_LH1(float, IEEESPTan
,
34 AROS_LHA(float, y
, D0
),
35 struct Library
*, MathIeeeSingTransBase
, 8, MathIeeeSingTrans
40 LONG z
,SIN
,Res
,ysquared
,yabs
,tmp
;
41 yabs
= y
& (IEEESPMantisse_Mask
+ IEEESPExponent_Mask
);
43 if (IEEESP_Pinfty
== yabs
)
45 SetSR(Overflow_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
49 z
= IEEESPFloor(IEEESPDiv(yabs
, pi
));
50 tmp
= IEEESPMul(z
,pi
);
51 tmp
|= IEEESPSign_Mask
; /* tmp = -tmp; */
52 yabs
= IEEESPAdd(yabs
, tmp
);
55 yabs
|= IEEESPSign_Mask
;
56 yabs
=IEEESPAdd(pi
, yabs
);
64 ysquared
= IEEESPMul(yabs
,yabs
);
75 IEEESPMul(ysquared
, sinf6
)))))))))));
86 IEEESPMul(ysquared
, cosf6
))))))))));
88 Res
= IEEESPDiv(SIN
, z
);
90 if (y
< 0 ) Res
^= IEEESPSign_Mask
;
91 if (TRUE
== tmp
) Res
^= IEEESPSign_Mask
;
95 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
99 if (Res
< 0) SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);