2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #include "mathtrans_intern.h"
8 /*****************************************************************************
12 AROS_LH1(float, SPTan
,
15 AROS_LHA(float, fnum1
, D0
),
18 struct Library
*, MathTransBase
, 8, MathTrans
)
21 Calculate the tangens of a given FFP number in radians
26 Motorola fast floating point number
30 negative : result is negative
37 *****************************************************************************/
41 LONG z
,SIN
,Res
,ysquared
,yabs
,tmp
;
42 yabs
= fnum1
& (FFPMantisse_Mask
+ FFPExponent_Mask
);
44 if ((LONG
)FFP_Pinfty
== yabs
)
46 SetSR(Overflow_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
50 z
= SPFloor(SPDiv(pi
, yabs
));
52 tmp
|= FFPSign_Mask
; /* tmp = -tmp; */
53 yabs
= SPAdd(yabs
, tmp
);
55 if ( (char)yabs
> (char)pio2
&& (yabs
& FFPMantisse_Mask
) > (pio2
& FFPMantisse_Mask
) )
58 yabs
=SPAdd(pi
, yabs
);
66 ysquared
= SPMul(yabs
,yabs
);
77 SPMul(ysquared
, sinf6
)))))))))));
88 SPMul(ysquared
, cosf6
))))))))));
92 if ((char)fnum1
< 0 ) Res
^= FFPSign_Mask
;
93 if (TRUE
== tmp
) Res
^= FFPSign_Mask
;
97 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
103 SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);