i need to write function that add two numbers but we have a processor that does not support a Variable type Float !!
So to represent fractions , is using a long integer is represented with actually represented using 4B-32bit.
We define the long bits as follows:
the MSB marked S -signed .
The 8 bits following marked E - Exponentially.
The remaining 23 bits marked M -mantissa.
The following formula represents the fraction in long:
(E^2)(M)(S^-1).
and i need to write the function :
unsigned long add(unsigned long float1, unsigned long float2)
that Receives two long values (which are actually fractions),add them and return the answer in long .
I tried to do something like this but i get stuck .
unsigned long add(unsigned long float1, unsigned long float2) {
char E1=float1>>23, E2=float2>>23, E3;
. . . .
thanks :)