lol Nadnerb, I love your calculator. So, how does it handle the fractionals? I am going a little crazy trying to figure out a simple formula.
[Nadnerb] oh..
[Nadnerb] well, there's two directions
[Nadnerb] converting a char string to a certain base
[Nadnerb] and converting an integer to a char string of a certain base
[Nadnerb] the integer to base string is shorter and simpler, but it's a recursive function.. <.<
I want something I can do on paper with a pencil.
[Nadnerb] and that might explode your brain.
[Nadnerb] the other direction is easier to understand...
[Nadnerb] we start with the highest order digit
[Nadnerb] and multuply the current value by the base, then add the next digit down.
[Nadnerb] when we hit a dot (decimal point or otherwise), we just keep going
[Nadnerb] so we end up with a much larger number than the actual result..
[Nadnerb] we count the number of places that we go past the dot...
[Nadnerb] and when we hit the end we divide the current value by 25^X
[Nadnerb] where X is the number of places after the dot
Ok, what does highest order digit mean? Let's say I want Base 10, 23.62, to be in base 25, which digit is the highest order digit?
[Nadnerb] --- Fini
[Nadnerb] 2
[Nadnerb] highest order is farthest to the left
Oooh, ok
[Nadnerb] soo.. we shall do that out.
[Nadnerb] 2*25 + 3
[Nadnerb] 53*25 + 6
[Nadnerb] 1331*25 + 2
[Nadnerb] 33277 / 25^2
Your Brilliant Nadnerb!
[Nadnerb] hmm..
[Nadnerb] not quite..
[Nadnerb] I just converted 23.62 _in base 25_ to base 10
oh
[Nadnerb] 53.2432
[Nadnerb] (that was going the other way)
[Nadnerb] the operation that you asked for is a little more complicated.
[Nadnerb] lets see here.
[Nadnerb] we divide the number (23.62) by the base (25)
[Nadnerb] ahh.
[Nadnerb] I'm going to have to not type all this out..
[Nadnerb] because it is not simple.
So 2*10+3, 23*10+6, 236*10+2, 2362/10^2= 23.62, yes?
[Nadnerb] oh, yes. :)
Ah
I am not sure Why that works, but, neat. :)
[Nadnerb] you converted from base 10 to base 10 <.<
[Nadnerb] but you seem to get the principle, so this is good. :D
[Nadnerb] so, how about 4A6 (base 25) to decimal? (base 10)
So base25 12.1212 is 12*25+12, 312*25+12, 7812/25^2=12.4992
That's Almost 12.5
[Nadnerb] yes..
[Nadnerb] that's caused by the rounding error
[Nadnerb] the precision of the floating point numbers only goes so far...
ok, 4A6 is 4,10,6 in My notation, so 4*25+10, 110*25+6, 2756?
[Nadnerb] correct!
Yipee!
So if it was 4A.6, I would say 2756/25^1, which is 110.24
[Nadnerb] yes
*grins*
Your smart Nadnerb
[Nadnerb] thanks
[Nadnerb] I must say, it took much longer to write the program than it did to work out how. <.<
I'm impressed by the simplicity
So, how about base10 to base25?
[Nadnerb] right..
[Nadnerb] I'm going to have to show you this one in two stages..
[Nadnerb] first, integers
[Nadnerb] then, if that works out, we can try the floating points
[Nadnerb] (I'm not even sure I can explain that properly anyway <.<)
[Nadnerb] let's do .. 233, since everyone knows the result to that anway. :D
[Nadnerb] ok..we divide by the base
[Nadnerb] 233 / 25 = 9.32
[Nadnerb] we truncate that
[Nadnerb] (9)
[Nadnerb] and that becomes the highest order digit
That's what my spreadsheet does
[Nadnerb] oh, ok.
[Nadnerb] with the fp
I force it to deal only with whole numbers
[Nadnerb] well, I'll finish this, and then to a fp
ok
[Nadnerb] 0.32 *25
[Nadnerb] is 8
[Nadnerb] 98
[Nadnerb] done
[Nadnerb] ok
Yah
[Nadnerb] 245.65
[Nadnerb] convert(245) + ".
[Nadnerb] " + convertfp(floatnum * base - math.floor(floatnum)*base)
[Nadnerb] O.o
Woah
[Nadnerb] meaning...
[Nadnerb] convert( 0.65)
[Nadnerb] we take out the integer portion
[Nadnerb] we have to do the same process again...
So, 0.65*25?
[Nadnerb] ya
[Nadnerb] keep goin
[Nadnerb] 0.65 * 25 is 16.25
[Nadnerb] .25 * 25 is 6.25
[Nadnerb] .25 * 25 is 6.25
[Nadnerb] and it keeps going
So 245.65 in base10 is 2*25+4, 54*25+5, 1355+0.65*25 = 1371.25?
[Nadnerb] ah.. we're goin the other way
[Nadnerb] but yes, what you just said is correct.
I'm confuzzled
[Nadnerb] if 245.65 was in base 25
Wait... uh...
[Nadnerb] 245.65 is in base 10
[Nadnerb] we're going TO base 25 with it.
[Nadnerb] 245 / 25 = 9.8
Ok, so, 245.65 is 2*10+4, 24*10+5, 245+0.65*25=261.25?
*rattles his head*
[Nadnerb] um
[Nadnerb] what?
[Nadnerb] no
[Nadnerb] ok, I'm going to do this out and post it all at once
[Nadnerb] wait a sec
245 decimal is 9,20 d'ni
0.65*25 is 16.25, but the number 25 is 1,0 in d'ni, so, 16.1?
So the number should be 9,20.16,1?
[Nadnerb] close..
[Nadnerb] converting 245.65 (decimal) to D'ni
[Nadnerb] 245 / 25 = 9.8
[Nadnerb] 0.8 * 25 = 20
[Nadnerb] 0.65 * 25 = 16.25
[Nadnerb] 0.25 * 25 = 6.25
[Nadnerb] 0.25 * 25 = 6.25
[Nadnerb] so:
[Nadnerb] 245.65 = (9, 20. 16, 6, 6, 6, etc)
[Nadnerb] it repeats indefinitely
Ooooh, I finaly see. :)
[K'laamas] *random quack*
Yay! Thanks K'laamas :)
Ok, I'm gonna leave for the day, Thanks Nadnerb :)
[Nadnerb] uh oh.
[Nadnerb] ok
[Nadnerb] cya Krepta!
[Nadnerb] *waves*