mirror of
https://github.com/Michaelangel007/apple2_print_fixed16_fraction.git
synced 2025-01-04 22:34:02 +00:00
Cleanup flow
This commit is contained in:
parent
04f9b73513
commit
9617fbf22a
11
README.md
11
README.md
@ -1,4 +1,4 @@
|
|||||||
# Print Fixed Point #.16 Fraction
|
# Print 16-bit Fixed Point Fraction
|
||||||
|
|
||||||
# Theory
|
# Theory
|
||||||
|
|
||||||
@ -6,14 +6,15 @@ Printing the fractional value of a 16-bit fixed point number in decimal is rathe
|
|||||||
|
|
||||||
For example, the number `0.7106` in 16-bit fixed point is 0.71506 * 65536 = 46,569 = `$B5E9`
|
For example, the number `0.7106` in 16-bit fixed point is 0.71506 * 65536 = 46,569 = `$B5E9`
|
||||||
|
|
||||||
How do we convert the number `$B5E9` back into `.7106` ? By _digit peeling._
|
* Q. How do we convert the number `$B5E9` back into `.7106` ?
|
||||||
|
* Q. By _digit peeling._
|
||||||
|
|
||||||
Given a fractional number `N` represented as 16-bit integer then:
|
Given a fractional number `N` represented as a 16-bit integer then the pseudo-code is:
|
||||||
|
|
||||||
1. Multiply N by 10
|
1. Multiply N by 10
|
||||||
2. Print the Integer Part digit
|
2. Print the Integer Part of `N` (a digit)
|
||||||
3. Set the Integer Part to zero
|
3. Set the Integer Part to zero
|
||||||
5. Have we printed the number of decimal digits we want? If no then goto step 1
|
5. Have we printed the total number of decimal digits we want? If no then goto step 1
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user