2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #include "mathtrans_intern.h"
10 Calculate the tangens of a given FFP number in radians
13 Motorola fast floating point number
17 negative : result is negative
33 AROS_LH1(float, SPTan
,
34 AROS_LHA(float, fnum1
, D0
),
35 struct Library
*, MathTransBase
, 8, MathTrans
40 LONG z
,SIN
,Res
,ysquared
,yabs
,tmp
;
41 yabs
= fnum1
& (FFPMantisse_Mask
+ FFPExponent_Mask
);
43 if ((LONG
)FFP_Pinfty
== yabs
)
45 SetSR(Overflow_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
49 z
= SPFloor(SPDiv(pi
, yabs
));
51 tmp
|= FFPSign_Mask
; /* tmp = -tmp; */
52 yabs
= SPAdd(yabs
, tmp
);
54 if ( (char)yabs
> (char)pio2
&& (yabs
& FFPMantisse_Mask
) > (pio2
& FFPMantisse_Mask
) )
57 yabs
=SPAdd(pi
, yabs
);
65 ysquared
= SPMul(yabs
,yabs
);
76 SPMul(ysquared
, sinf6
)))))))))));
87 SPMul(ysquared
, cosf6
))))))))));
91 if ((char)fnum1
< 0 ) Res
^= FFPSign_Mask
;
92 if (TRUE
== tmp
) Res
^= FFPSign_Mask
;
96 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
102 SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);