449,409 Members | 1,148 Online Need help? Post your question and get tips & solutions from a community of 449,409 IT Pros & Developers. It's quick & easy.

# Floating point calculation

 P: n/a I'm working in an ARM (ARM9) system which does not have Floating point co-processor or Floating point libraries. But it does support long long int (64 bits). Can you provide some link that would discuss about ways to emulate floating point calculations with just long int or long long int. For eg., if i've a formula X=(1-b)*Y + b*Z in floating point domain, i can calculate X with just long ints (but, some data may be lost in final division; That's OK) Floating Point: X=(1-b)*Y + b*Z /* 'b' is a floating point variable with 4 points precision and 'b' is in the range of 0 to 1;X, Y and Z are unsigned int*/ With long int: I can emulate the above calculation as: X=((10000-10000*b)*Y +10000*b*Z)/10000 I'm in need of some link that would discuss this and any similar approach. -- -Vinoth Nov 14 '05 #1
7 Replies

 P: n/a Vinoth wrote: I'm working in an ARM (ARM9) system which does not have Floating point co-processor or Floating point libraries. But it does support long long int (64 bits). Can you provide some link that would discuss about ways to emulate floating point calculations with just long int or long long int. For eg., if i've a formula X=(1-b)*Y + b*Z in floating point domain, i can calculate X with just long ints (but, some data may be lost in final division; That's OK) Floating Point: X=(1-b)*Y + b*Z /* 'b' is a floating point variable with 4 points precision and 'b' is in the range of 0 to 1;X, Y and Z are unsigned int*/ With long int: I can emulate the above calculation as: X=((10000-10000*b)*Y +10000*b*Z)/10000 I'm in need of some link that would discuss this and any similar approach. -- -Vinoth One way of faking floating point that I thought of is to find free multi-precision math libraries -- GNU mp and the library that comes with GNU bc and dc come to mind -- since those libraries treat the numbers as arrays of digits. Gregory Pietsch Nov 14 '05 #2 