This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
pdclib:floatingpoint [2019/10/17 17:18] solar [Floating-Point Printout (Dragon2)] |
pdclib:floatingpoint [2019/10/21 10:13] (current) solar [Floating-Point Printout] |
||
---|---|---|---|
Line 207: | Line 207: | ||
* multiply <m>M = 0.015625</ | * multiply <m>M = 0.015625</ | ||
* Fractional part < | * Fractional part < | ||
- | * Second (<m>k = 2</m> loop | + | * Second (<m>k = 2</m>) loop |
- | * multiply <m>R = 0.835</ | + | * multiply <m>R = 0.835</ |
- | * multiply <m>M = 0.15625< | + | * multiply <m>M = 0.15625</m> by <m>B = 10</ |
* Fractional part < | * Fractional part < | ||
* Post-loop | * Post-loop | ||
Line 215: | Line 215: | ||
* We have <m>N = k = 2</m> fractional digits in our result of < | * We have <m>N = k = 2</m> fractional digits in our result of < | ||
- | ==== Floating-Point Printout | + | ==== Floating-Point Printout ==== |
Given: | Given: | ||
Line 224: | Line 224: | ||
* An approximate representation to base //B//, using exponential notation if the value is very large or very small. | * An approximate representation to base //B//, using exponential notation if the value is very large or very small. | ||
+ | |||
+ | Algorithm (Dragon2): | ||
+ | |||
+ | * Compute <m>v prime = v * B ^ {-x}</ | ||
+ | * Print the integer part of <m>v prime</ | ||
+ | * Print a decimal point | ||
+ | * Take the fractional part of <m>v prime</ | ||
+ | * Apply algorithm < | ||
+ | * If < |