Starting from:

$30

CS231-Lab 9 Soived

1. The trigonometric function cosine has the following Taylor expansion

 

Implement a procedure cosine in MIPS assembly language that, given a value x in radian, approximates cos(x) using the expansion above. You can set the last term to  . The procedure takes the argument x in register $f12 and returns the result in register $f0. All floating point numbers are single precision. Your program should prompt the user for x in degree (so your program should convert x to radian first) and print out cos(x). For example, for x = 32, it should output 0.8480481, i.e., cos(32) = 0.8480481. Your program should continue prompting until the user inputs −1. Do not forget to follow the MIPS convention. pi = 3.14159265359

You can implement your own procedures for power and factorial.

More products