#32300 - StealthElement - Mon Dec 20, 2004 11:19 pm
Why is a third of something finite in space but decimally it never terminates?
#32305 - tepples - Mon Dec 20, 2004 11:49 pm
Decimally it does terminate if you round off to the nearest width of an atom. This approximation is what makes fixed-point arithmetic work.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#32306 - sajiimori - Tue Dec 21, 2004 12:30 am
Any decimal value that begins with 0.3 obviously cannot be greater than or equal to 0.4, regardless of how many digits you append.
#32318 - sgeos - Tue Dec 21, 2004 2:21 am
StealthElement wrote: |
Why is a third of something finite in space but decimally it never terminates? |
Because 3 contains a prime factor that is neither 2 nor 5. 1/3, 1/7, 1/9, 1/11, 1/12... none of these terminate in the base 10 numbering system. 1/3 terminates in the base 3 numbering system (it is 0.1).
I believe it was the ancient Babylonians who used a base 60 numbering system. They were not comforatable with nonterminating fractions. 60 has a lot of factors! (Prime factors in bold.) 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, and 60.
Does anyone know anything offhand about the properties terminating fractions in mixed radix numbering systems? (Digits overflow at different values in mixed radix numbering systems.)
Edit: Fixed a few minor errors.
-Brendan
#32544 - sajiimori - Thu Dec 23, 2004 7:20 pm
Yeah, here's one: if you change your radix to the value of the remainder, then it'll terminate pretty fast. ;)
#32598 - sgeos - Fri Dec 24, 2004 7:10 am
Something like this?
get_mixed_radix_numbering_system(n); /* =) */
I could see a 'factorial radix' numbering system or a 'prime radix' numbering system as being useful.
factorial radix max digits:
Code: |
...987654321 ==
(digit counter) * (digit value)
1 * 1! + (== 1 * 1)
2 * 2! + (== 2 * 2)
3 * 3! + (== 6 * 3)
4 * 4! + (== 24 * 4)
5 * 5! + (== 120 * 5)
6 * 6! + (== 720 * 6)
7 * 7! + (== 5040 * 7)
8 * 8! + (== 40320 * 8)
9 * 9! == (== 362880 * 9)
10! - 1 (== 3628799) |
prime radix max digits: (this one is crazier and probably less useful)
Code: |
...CA6421 ==
(digit counter) * (digit value)
1 * (1) +
2 * (2) +
4 * (2 * 3) +
6 * (2 * 3 * 5) +
10 * (2 * 3 * 5 * 7) +
12 * (2 * 3 * 5 * 7 * 11) ==
2 * 3 * 5 * 7 * 11 * 13 - 1 (== 30029) |
-Brendan