### Prompts the user for an angle in degrees, converts it into radians ### Calculates the Cosine using Series Convergence ### Cos(x) = 1 - x2/2! + x4/4! - x6/6! # 1 - x2/2! + x4/4! - x6/6! # Xold f0 f1 # Xnew f2 f3 # Angle f4 f5 # Threshold f6 f7 # Term index = $t1 .data Angle: .double 0.0 #the angle in radians to compute 45degrees THold: .double 0.000001 #accuracy threshold Neg1: .double -1.0 #-1,0 used to change the Sign of Sign Sign: .double -1.0 #Sign of the term PI: .double 3.141592653 _180: .double 180.0 Prompt: .asciiz "Enter the angle in Degrees: " .text jal GetAngle #get the angle in degrees li $t0, 1 #Initialize Xold to 1 mtc1 $t0, $f2 #move 1 to $f0 and convert it into a double cvt.d.w $f2,$f2 #f0 and f1 contain the double rep of 1 move $t0, $0 #initialize Xnew to 0.0 mtc1 $t0, $f0 cvt.d.w $f0, $f0 ldc1 $f4, Angle #load the Angle ldc1 $f6, THold #load the Threshold li $t1, 2 # term index value used for power and factorial loop0: #while (abs(Xold -Xnew) > Threshold c.lt.d 1,$f0, $f2 #if f0