huge numbers
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

huge numbers

Started by chill, 01 June, 2004, 22:13:40

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

chill

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.

NotRabidWombat

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


I like childish behavior. Maybe this post will be deleted next.

chill

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.

NotRabidWombat

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


I like childish behavior. Maybe this post will be deleted next.

chill

#4
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.

NotRabidWombat

... 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


I like childish behavior. Maybe this post will be deleted next.

chill

QuoteOR you add a complexity of modulus with division.
lol yepp I think I'll do that :).

SMF spam blocked by CleanTalk