08-03-2022, 05:39 PM
@Stuart
Great post! Woohoo, my routine was able to identify .000000000000001184237892933500309785207112630208333333 as an eventual infinite repetend of 3s.
.000000000000001184237892933500309785207112630208333333
So for fun, let's turn that decimal into a fraction...
10^48 * .000000000000001184237892933500309785207112630208333333 = 1184237892933500309785207112630208.333333
10^ 50 * .000000000000001184237892933500309785207112630208333333 = 118423789293350030978520711263020833.3333
118423789293350030978520711263020833.333333
- 1184237892933500309785207112630208.333333
------------------------------------------------------------
117239551400416530668735504150390625
99000000000000000000000000000000000000000000000000 / 117239551400416530668735504150390625 =
1 / 844424930131968
I bring this up because since I'm not onboard with resorting to bit turning math, or whatever it's called, I'm getting curious about converting to fractions to round repetends. As such...
1 / 3 * 3
digital = 1 / 3 = .3... but * 3 = .999... unless the repetend is handled properly in multiplying back to 1.
So with fractions,
1 3
- * - = 1 No problem.
3 1
so if I write an algorithm that does the following...
.3... * 3
10x * .3... = 3.3...
1000x * .3 = 333.3
333.3
- 3.3 = 330
1000x
- 10x = 990x
990x = 330
330 / 990 reduced = 1 /3
1 / 3 * 3 = 3 /3 = 1
So converting to fraction multiplication now 1 / 3 * 3 = 1 instead of .9...
Well, easy in theory, but when we get into really big number repetends, it might be difficult and slow to implement.
Pete
Great post! Woohoo, my routine was able to identify .000000000000001184237892933500309785207112630208333333 as an eventual infinite repetend of 3s.
.000000000000001184237892933500309785207112630208333333
So for fun, let's turn that decimal into a fraction...
10^48 * .000000000000001184237892933500309785207112630208333333 = 1184237892933500309785207112630208.333333
10^ 50 * .000000000000001184237892933500309785207112630208333333 = 118423789293350030978520711263020833.3333
118423789293350030978520711263020833.333333
- 1184237892933500309785207112630208.333333
------------------------------------------------------------
117239551400416530668735504150390625
99000000000000000000000000000000000000000000000000 / 117239551400416530668735504150390625 =
1 / 844424930131968
I bring this up because since I'm not onboard with resorting to bit turning math, or whatever it's called, I'm getting curious about converting to fractions to round repetends. As such...
1 / 3 * 3
digital = 1 / 3 = .3... but * 3 = .999... unless the repetend is handled properly in multiplying back to 1.
So with fractions,
1 3
- * - = 1 No problem.
3 1
so if I write an algorithm that does the following...
.3... * 3
10x * .3... = 3.3...
1000x * .3 = 333.3
333.3
- 3.3 = 330
1000x
- 10x = 990x
990x = 330
330 / 990 reduced = 1 /3
1 / 3 * 3 = 3 /3 = 1
So converting to fraction multiplication now 1 / 3 * 3 = 1 instead of .9...
Well, easy in theory, but when we get into really big number repetends, it might be difficult and slow to implement.
Pete