patch-2.1.73 linux/arch/i386/math-emu/poly_tan.c

Next file: linux/arch/i386/math-emu/reg_add_sub.c
Previous file: linux/arch/i386/math-emu/poly_sin.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.72/linux/arch/i386/math-emu/poly_tan.c linux/arch/i386/math-emu/poly_tan.c
@@ -3,9 +3,9 @@
  |                                                                           |
  | Compute the tan of a FPU_REG, using a polynomial approximation.           |
  |                                                                           |
- | Copyright (C) 1992,1993,1994                                              |
+ | Copyright (C) 1992,1993,1994,1997                                         |
  |                       W. Metzenthen, 22 Parker St, Ormond, Vic 3163,      |
- |                       Australia.  E-mail   billm@vaxc.cc.monash.edu.au    |
+ |                       Australia.  E-mail   billm@suburbia.net             |
  |                                                                           |
  |                                                                           |
  +---------------------------------------------------------------------------*/
@@ -13,6 +13,7 @@
 #include "exception.h"
 #include "reg_constant.h"
 #include "fpu_emu.h"
+#include "fpu_system.h"
 #include "control_w.h"
 #include "poly.h"
 
@@ -52,7 +53,7 @@
 /*--- poly_tan() ------------------------------------------------------------+
  |                                                                           |
  +---------------------------------------------------------------------------*/
-void	poly_tan(FPU_REG const *arg, FPU_REG *result)
+void	poly_tan(FPU_REG *st0_ptr)
 {
   long int    		exponent;
   int                   invert;
@@ -60,20 +61,20 @@
                         argSignif, fix_up;
   unsigned long         adj;
 
-  exponent = arg->exp - EXP_BIAS;
+  exponent = exponent(st0_ptr);
 
 #ifdef PARANOID
-  if ( arg->sign != 0 )	/* Can't hack a number < 0.0 */
-    { arith_invalid(result); return; }  /* Need a positive number */
+  if ( signnegative(st0_ptr) )	/* Can't hack a number < 0.0 */
+    { arith_invalid(0); return; }  /* Need a positive number */
 #endif PARANOID
 
   /* Split the problem into two domains, smaller and larger than pi/4 */
-  if ( (exponent == 0) || ((exponent == -1) && (arg->sigh > 0xc90fdaa2)) )
+  if ( (exponent == 0) || ((exponent == -1) && (st0_ptr->sigh > 0xc90fdaa2)) )
     {
       /* The argument is greater than (approx) pi/4 */
       invert = 1;
       accum.lsw = 0;
-      XSIG_LL(accum) = significand(arg);
+      XSIG_LL(accum) = significand(st0_ptr);
  
       if ( exponent == 0 )
 	{
@@ -92,12 +93,12 @@
     {
       invert = 0;
       argSignif.lsw = 0;
-      XSIG_LL(accum) = XSIG_LL(argSignif) = significand(arg);
+      XSIG_LL(accum) = XSIG_LL(argSignif) = significand(st0_ptr);
  
       if ( exponent < -1 )
 	{
 	  /* shift the argument right by the required places */
-	  if ( shrx(&XSIG_LL(accum), -1-exponent) >= 0x80000000U )
+	  if ( FPU_shrx(&XSIG_LL(accum), -1-exponent) >= 0x80000000U )
 	    XSIG_LL(accum) ++;	/* round up */
 	}
     }
@@ -206,8 +207,8 @@
 
   /* Transfer the result */
   round_Xsig(&accum);
-  *(short *)&(result->sign) = 0;
-  significand(result) = XSIG_LL(accum);
-  result->exp = EXP_BIAS + exponent;
+  FPU_settag0(TAG_Valid);
+  significand(st0_ptr) = XSIG_LL(accum);
+  setexponent16(st0_ptr, exponent + EXTENDED_Ebias);  /* Result is positive. */
 
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov