Repeating Decimals
|
01-21-2018, 10:22 PM
(This post was last modified: 01-21-2018 10:48 PM by StephenG1CMZ.)
Post: #12
|
|||
|
|||
RE: Repeating Decimals
Joe Horn, it occurs to me that there is an important difference between your latest algorithm and the earlier one using Multiplicative Order, that might mean the earlier algorithm remains useful.
If I understand your latest algorithm correctly, it outputs the transient part and then keeps producing the recurring part until it identifies that it is going to repeat. That means there is no advance knowledge of how long the repeating part is... Which could mean you consume lots of resources (time, disk space, ...) Producing lots of digits before exhausting resources. By contrast, your solution using multiplicative order starts by working out how many recurring digits there will be...providing the opportunity to just return NaN before exhausting resources. By the way, do you think adding a final underscore to numbers would be a useful formatting improvement? It is clear that 1.2_34_ has 34 as the repeating part, whereas 1.2_34 leaves room for doubt as to whether the number has exceeded the size of a page. Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)