|
Re: Programming/maths question....soft floats...
07/26/13 07:50 PM
|
|
|
As for keeping "significant digits": if you mean keeping decimal digits, you definitely should see this: http://floating-point-gui.de/
As for dividing without a division instruction: see this: http://www.math.usm.edu/lambers/mat460/fall09/lecture10.pdf
If you are working on integers, and want the result as a percentage, you don't need soft floats. You can compute (A/B) as ((100*A)/B) and have your answer as a percentage. If you want to round to the nearest percentage point, compute (A/B) as ((((200*A)/B)+1)/2) or maybe ((((200*A)/B)+1)>>1) where >> is binary right-shift.
|
|