??? 04/19/05 09:38 Read: times |
#91909 - Accuracy Responding to: ???'s previous message |
Please test it and let me know. Since my calculation sometimes not a round number, therefore the accuracy is a little bit off.
For instance: (60 x 66)/ 70 = 56.57 but it display in 38H because this isn't floating point MCU. In your case, my humble way to increase the accuracy, if really needed, is to continue as follows: I multiply the 'innacurate' result by the divisor to find out the difference 'D' with the 'numerator'. Then I multiply 'D' by 100 (or other accuracy factor) and divide again the result by the divisor. for example: (8 bit x 8 bit) 60*66=3960 -> Num1 (16 bit / 8 bit) Num1/70=3960/70=56 -> R1 -> 56.00 (8 bit x 8 bit) R1*70=56*70=3920 -> Num2 (16 bit - 16 bit) Num1-Num2=3960-3920=40 -> D (8 bit x 8 bit) D*100=40*100=4000 (16 bit / 8 bit) 4000/70=57 -> the decimal part 0.57 To display the end result, a 'Binary to BCD' routine is needed too. |
Topic | Author | Date |
16bit by 8bit divide | 01/01/70 00:00 | |
Check This! | 01/01/70 00:00 | |
And This: | 01/01/70 00:00 | |
16bit by 8bit divide | 01/01/70 00:00 | |
Re: | 01/01/70 00:00 | |
16bit by 8bit divide | 01/01/70 00:00 | |
To Thelam: | 01/01/70 00:00 | |
well, if you look a bit to the left | 01/01/70 00:00 | |
16bit by 8bit divide | 01/01/70 00:00 | |
Its just ben done | 01/01/70 00:00 | |
Non-iterative Division | 01/01/70 00:00 | |
Accuracy | 01/01/70 00:00 | |
No wonder | 01/01/70 00:00 | |
again and again | 01/01/70 00:00 | |
Efficient Division | 01/01/70 00:00 | |
the divide may ne the tip of the iceberg | 01/01/70 00:00 | |
16bit by 8bit divide | 01/01/70 00:00 | |
the Titanic hit the iceberg | 01/01/70 00:00 | |
16bit by 8bit divide | 01/01/70 00:00 | |
Don't know if it helps.![]() | 01/01/70 00:00 |