Post Reply 
Repeating Decimals
01-21-2018, 10:41 PM (This post was last modified: 01-21-2018 10:43 PM by Joe Horn.)
Post: #13
RE: Repeating Decimals
(01-21-2018 10:22 PM)StephenG1CMZ Wrote:  Jo 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.

Correct. The non-multiplicative-order algorithm is much simpler to code, but for large repeating sections it runs much slower. In fact, if you use instead the algorithm which pre-calculates the repeating section's length (using the multiplicative order), ALL of decimal number's digits (both the transient and repeating sections) can be obtained with a SINGLE simple calculation, without any looping at all. It would make a Prime program for fraction-to-repeating-decimal a bazillion timers faster than the non-multiplicative-order algorithm, even for huge denominators. I'll keep watching these discussions to see if anybody programs this method... if they haven't already.

EDIT: Ooh ooh, I see above that you have! Do you generate the digits by looping or all at once? I gotta go look...

<0|ΙΈ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Repeating Decimals - lrdheat - 01-13-2018, 12:22 AM
RE: Repeating Decimals - lrdheat - 01-13-2018, 12:23 AM
RE: Repeating Decimals - salvomic - 01-13-2018, 10:06 AM
RE: Repeating Decimals - lrdheat - 01-13-2018, 06:09 PM
RE: Repeating Decimals - Joe Horn - 01-17-2018, 06:20 AM
RE: Repeating Decimals - lrdheat - 01-18-2018, 05:46 AM
RE: Repeating Decimals - Joe Horn - 01-19-2018, 03:58 AM
RE: Repeating Decimals - lrdheat - 01-19-2018, 03:11 PM
RE: Repeating Decimals - Joe Horn - 01-20-2018, 06:02 AM
RE: Repeating Decimals - StephenG1CMZ - 01-20-2018, 09:08 AM
RE: Repeating Decimals - StephenG1CMZ - 01-21-2018, 11:34 AM
RE: Repeating Decimals - StephenG1CMZ - 01-21-2018, 10:22 PM
RE: Repeating Decimals - Joe Horn - 01-21-2018 10:41 PM
RE: Repeating Decimals - StephenG1CMZ - 01-21-2018, 10:58 PM
RE: Repeating Decimals - Joe Horn - 01-22-2018, 01:35 AM
RE: Repeating Decimals - tgray - 01-23-2018, 01:46 AM
RE: Repeating Decimals - Joe Horn - 01-23-2018, 02:18 AM
RE: Repeating Decimals - tgray - 01-23-2018, 02:24 AM
RE: Repeating Decimals - lrdheat - 01-27-2018, 09:53 PM
RE: Repeating Decimals - StephenG1CMZ - 02-05-2018, 11:34 PM
RE: Repeating Decimals - StephenG1CMZ - 02-06-2018, 11:34 PM



User(s) browsing this thread: 1 Guest(s)