User Tools

Site Tools


2014:mathematics_asm

Mathematics function in assembly

by Cyprien Guillemot, Bonjun Gu, Pil Hun Choi

What did you do?

For our final project we decided to code some mathematics function in assembly. We made:

  • Exponential
  • Logarithm
  • Cos
  • Sin
  • Tan
  • Power

Why did you do it?

We decided to choose this project to see how difficult it is to program simple function in assembly. And this project was also the occasion to discover how to deal with float number in assembly.

How Did You Do It?

To make all these functions we use the Taylor series. We use recursive algorithm to make it. Each time the function calculate a term and add it to the sum. In order to achieve this, we made two functions that are used in every function: power and fact.

Difficulties

The only difficulty was to know how to work with float number. It appears that it is almost the same than working with integer. The only tricky part was to know how we can cast an integer to a float.

How to run it?

To run it, download Mars and our project. Load one of the file in the archive. Build and run it. The result should be in the register $f0. If you want to calculate at other value, change the value of the register $f5. The value of $a1 is the number of term to calculate.

2014/mathematics_asm.txt · Last modified: 2014/12/17 13:56 by 2014_mathematics-asm