Hi there!
I'm trying to implement fp numbers that can be approximated in C with this structure:
Code:
struct fp
{
char sign; // 1 = negative
unsigned short exponent; // 32768 = 10**0
unsigned char mantissa[8]; // Packed-BCD (16 digits)
}
E.g. p [pi] would be stored as:
Code:
fp.sign = 0;
fp.exponent = 32768
fp.mantissa = {0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93};
And what I would like to know is how to implement fast multiplication, division, and exponentiation functions.
P.S. There isn't any FPU, in case you were wondering.