AriCalculator is a home made pocket calculator.
|
08-01-2017, 02:59 AM
(This post was last modified: 08-01-2017 03:19 AM by Dan.)
Post: #42
|
|||
|
|||
RE: AriCalculator is a home made pocket calculator.
Converting to binary is unavoidable - my multiplication and division algorithms are based on "shift and add" methods . Also I haven't observed any incorrect results arising from converting between BCD and binary. All arithmetic is integer so there are no issues with numbers that cannot be expressed exactly in binary.
e.g. 1.2 * 0.3 = 0001 0010 FF * 0000 0011 FF The BCD values in the mantissas are converted to binary, giving: 0000 1100 FF * 0000 0011 FF. The "shift and add" algorithm is applied to find the product of the mantissas, and the exponents are added, giving: 0010 0100 FE = 0.36 This is then converted back to BCD: 0011 0110 FE If the conversion to binary were not made, then: 1.2 * 0.3 = 0001 0010 FF * 0000 0011 FF = 0011 0110 FE = 0.54 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)