2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #include "mathieeesingtrans_intern.h"
8 /*****************************************************************************
12 AROS_LH1(float, IEEESPTan
,
15 AROS_LHA(float, y
, D0
),
18 struct Library
*, MathIeeeSingTransBase
, 8, MathIeeeSingTrans
)
21 Calculate the tangens of a given IEEE single precision number in radians
26 IEEE single precision floating point number
30 negative : result is negative
37 *****************************************************************************/
41 LONG z
,SIN
,Res
,ysquared
,yabs
,tmp
;
42 yabs
= y
& (IEEESPMantisse_Mask
+ IEEESPExponent_Mask
);
44 if (IEEESP_Pinfty
== yabs
)
46 SetSR(Overflow_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
50 z
= IEEESPFloor(IEEESPDiv(yabs
, pi
));
51 tmp
= IEEESPMul(z
,pi
);
52 tmp
|= IEEESPSign_Mask
; /* tmp = -tmp; */
53 yabs
= IEEESPAdd(yabs
, tmp
);
56 yabs
|= IEEESPSign_Mask
;
57 yabs
=IEEESPAdd(pi
, yabs
);
65 ysquared
= IEEESPMul(yabs
,yabs
);
76 IEEESPMul(ysquared
, sinf6
)))))))))));
87 IEEESPMul(ysquared
, cosf6
))))))))));
89 Res
= IEEESPDiv(SIN
, z
);
91 if (y
< 0 ) Res
^= IEEESPSign_Mask
;
92 if (TRUE
== tmp
) Res
^= IEEESPSign_Mask
;
96 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
100 if (Res
< 0) SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);