well, I was wondering if it is possible to create huge exact number with LUA.
So that when I type 2^1234567 I get the number shown till the last digit,
I need this cause I had the idea of converting a string, to number, by exchanging the char to it equvalent strchar number
so a string get converted into something like
004234067 ... and so on now I cut the first 2 zeros and have number, now I check
how near I can get to that number with 2^x and either subtract the rest or add a rest either + interger or 2^x or anything else , so but to convert the number back to a string I need something that shows me the exact number and not 45e10, well anyways, it was just a idea and I failed right at the start, please point me in the right direction, or if I am on such a stoney path, well anyways, would be great if this could be done with LUA.
And I know Mathematica or Maple, but I need it in LUA.
To answer your first question: http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/
However, this can only be done with loadlib.
To resolve a much more complicated matter, why would you EVER want to do this? Converting the string will not save any significant amount of memory, but it will promote buggy code and take time for conversions. All comparisons with the string are already performed on the binary level.
-NotRabidWombat
well I just had the idea, but I tried a bit yesterday, and also came to the conclusion all the conversion would take a while, but just to talk about memory
if you take 2^1234567 you do get a number with a few million digits, so it should save some memory.
but your right this is not the way, but maybe I can use this for something else we'll see.
thx for the link.
Well converting the string to number is really going backwards. You would be making a sueto char array. But a char array is not a string. A string is an object, with methods and members designed to make working with that object as easy as possible. It may not be the MOST memory efficient but that's not the goal.
-NotRabidWombat
well it was a idea, and if it worked it would be good, I mean imagine 2^1234567 is number with a few million digits, divied it by 3 and you have like a few hundret thousand, compared to 9 digits, okey, its just a exsample, you would need to substract some stuff also, but it would be great if, even greater if we had 999 chars.
but as we don't have this all, the goal to reduce memory used by a string, is far far away, with this method.
... WHY? Memory is CHEAP.
"2^1234567 is number with a few million digits"
No, you have a few million bits and 154321 bytes.
"divied it by 3 and you have like a few hundret thousand,"
Ok, so now you have floating points and fuzzy logic.
OR you add a complexity of modulus with division.
-NotRabidWombat
QuoteOR you add a complexity of modulus with division.
lol yepp I think I'll do that :).