Jump to content


Photo

Big Integer Dll


  • Please log in to reply
14 replies to this topic

#1 halo shg

halo shg

    Programmer

  • GMC Member
  • 600 posts
  • Version:GM:Studio

Posted 25 November 2009 - 12:22 AM

Big Integer Dll
By Halo Shg




Finally you can handle those huge numbers.

Functions:
  • bigint_init
  • bigint_add
  • bigint_subtract
  • bigint_multiply
  • bigint_divide
  • bigint_power
What more do I need to say
Download:
Direct Link

EDIT: Totally went 6 years in the past to fix a link. Enjoy!

Edited by halo shg, 29 March 2015 - 02:20 AM.

  • 0

Dev: MacBook Pro Retina Display 15" w/ Win7 (Parallels) running GM Studio: Master and GM8 (GMS: ANDROID JAVA EXTENSIONS ARE HERE!)
Devices: Samsung Galaxy Note II / Samsung Galaxy S III / iPhone 4S / iPad 2 / iPod Touch 5th gen



Politics' is made up of two words, 'poli,' which is Greek for 'many,' and 'tics,' which are blood-sucking insects.


-Gore Vidal


#2 margoose

margoose

    GMC Member

  • GMC Member
  • 277 posts

Posted 02 December 2009 - 12:02 AM

is it integers only? what is the max size?
  • 0
My Creations:


#3 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 02 December 2009 - 11:59 AM

It's probably a 64-bit Integer. So no decimal, 18446744073709551615 unsigned maximum (correct me if I'm wrong).
  • 0

#4 score_under

score_under

    Least kawaii

  • GMC Member
  • 1321 posts

Posted 02 December 2009 - 06:35 PM

It's probably a 64-bit Integer. So no decimal, 18446744073709551615 unsigned maximum (correct me if I'm wrong).

It's a "big number" library. It can store a lot more than that. If it's coded correctly, it can store numbers of theoretically infinite length.
  • 0

Anti-Decompiler for GM6.1 to GM8.1.91! :GM8_new: [Main skin by Sindarin]
Discontinued.

decimal2.png
^ Signature image because it's been sorta empty since the old host died

If you need to contact me, I still get notification emails from PMs.


#5 halo shg

halo shg

    Programmer

  • GMC Member
  • 600 posts
  • Version:GM:Studio

Posted 02 December 2009 - 08:21 PM

The only limit is memory. And only integer, so 100/3 would output 33.
  • 0

Dev: MacBook Pro Retina Display 15" w/ Win7 (Parallels) running GM Studio: Master and GM8 (GMS: ANDROID JAVA EXTENSIONS ARE HERE!)
Devices: Samsung Galaxy Note II / Samsung Galaxy S III / iPhone 4S / iPad 2 / iPod Touch 5th gen



Politics' is made up of two words, 'poli,' which is Greek for 'many,' and 'tics,' which are blood-sucking insects.


-Gore Vidal


#6 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 03 December 2009 - 12:59 PM

It's probably a 64-bit Integer. So no decimal, 18446744073709551615 unsigned maximum (correct me if I'm wrong).

It's a "big number" library. It can store a lot more than that. If it's coded correctly, it can store numbers of theoretically infinite length.

orly?

Well, okay. Didn't think of that.
  • 0

#7 general sirhc

general sirhc

    Dream Big, Act Small

  • GMC Member
  • 1667 posts
  • Version:GM:Studio

Posted 21 January 2010 - 03:20 PM

Ha ha I was making a DLL just like this but I'm not advanced enough in c++ to be able to work it out properly, you wouldn't mind releasing the source for this so I could see how you did it would you?

EDIT:
When it unfreezes I will be able to finally tell people how many possible email address exist on the hotmail server, its approximately power(60,64)...
  • 0

qs8ZFMQ.png?1


#8 vadim647

vadim647

    Quite Epic

  • New Member
  • 840 posts

Posted 21 January 2010 - 03:40 PM

Ha ha I was making a DLL just like this but I'm not advanced enough in c++ to be able to work it out properly, you wouldn't mind releasing the source for this so I could see how you did it would you?

EDIT:
When it unfreezes I will be able to finally tell people how many possible email address exist on the hotmail server, its approximately power(60,64)...

Obviously, you need to divide it into steps, with output between steps.
More obviously, your pc gets stuck somewhere around ^40, since numbers grow a lot.
Also, you could simply do (6,64) and then add 64 digits, I think.
  • 0
We'll meet again, if you will find me.

#9 halo shg

halo shg

    Programmer

  • GMC Member
  • 600 posts
  • Version:GM:Studio

Posted 23 January 2010 - 04:09 PM

Ha ha I was making a DLL just like this but I'm not advanced enough in c++ to be able to work it out properly, you wouldn't mind releasing the source for this so I could see how you did it would you?

I don't actually have the source right now (I'm on my Mac and I don't even have my PC even set up right now) but I can tell you it uses this Big Integer library. I use the function "BigIntegerToString" to convert it to a string, then convert it to a char* using standard C++ functions.

EDIT:
When it unfreezes I will be able to finally tell people how many possible email address exist on the hotmail server, its approximately power(60,64)...

You don't even need my DLL for that:
http://www.wolframal.../input/?i=60^64

6.334028666297327770616228694681188660989646182809
6 x 10113


  • 0

Dev: MacBook Pro Retina Display 15" w/ Win7 (Parallels) running GM Studio: Master and GM8 (GMS: ANDROID JAVA EXTENSIONS ARE HERE!)
Devices: Samsung Galaxy Note II / Samsung Galaxy S III / iPhone 4S / iPad 2 / iPod Touch 5th gen



Politics' is made up of two words, 'poli,' which is Greek for 'many,' and 'tics,' which are blood-sucking insects.


-Gore Vidal


#10 queviltai

queviltai

    Cat

  • GMC Member
  • 445 posts

Posted 25 January 2010 - 12:05 PM

6.334028666297327770616228694681188660989646182809
6 x 10113

That is a BIG number.

This DLL will be useful for simulation and physics projects. I remember somebody on the GMC a while ago trying to create a model of the solar system with GM, and he ran into this problem. Without really large numbers the accuracy he wanted would be impossible.

Edited by queviltai, 25 January 2010 - 12:10 PM.

  • 0

#11 Maarten Baert

Maarten Baert

    GMC Member

  • GMC Member
  • 750 posts
  • Version:GM8.1

Posted 25 January 2010 - 02:18 PM

6.334028666297327770616228694681188660989646182809
6 x 10113

That is a BIG number.

This DLL will be useful for simulation and physics projects. I remember somebody on the GMC a while ago trying to create a model of the solar system with GM, and he ran into this problem. Without really large numbers the accuracy he wanted would be impossible.

Using integers for physics? Maybe you can use it to store the position but I would never use integers to store forces or velocities. If wanted to create a model of the solar system I would use floating-point arithmetic, not integers. You don't need high precision far away from the origin (the sun for planets, the planet for moons). I don't think integers are useful in this case. You can always use 128-bit floats (or higher) if the precision isn't good enough.
  • 0
Posted Image

#12 ze1

ze1

    GMC Member

  • GMC Member
  • 153 posts
  • Version:GM:Studio

Posted 11 February 2010 - 08:46 PM

Is there any way to compare a "big integer" with a normal number or with another "big integer"? ==, !=, <, > etc won't do...
  • 0

#13 score_under

score_under

    Least kawaii

  • GMC Member
  • 1321 posts

Posted 12 February 2010 - 04:45 PM

Is there any way to compare a "big integer" with a normal number or with another "big integer"? ==, !=, <, > etc won't do...

Calculate A-B, then check the first character - if it's "-", then B>A, if it's 0 then B=A, if it's anything else then B<A.

Edited by score_under, 12 February 2010 - 04:46 PM.

  • 0

Anti-Decompiler for GM6.1 to GM8.1.91! :GM8_new: [Main skin by Sindarin]
Discontinued.

decimal2.png
^ Signature image because it's been sorta empty since the old host died

If you need to contact me, I still get notification emails from PMs.


#14 Whiterock

Whiterock

    GMC Member

  • New Member
  • 5 posts

Posted 01 January 2012 - 09:56 PM

The power function doesn't work like it should for me: 5^1 outputs 5^2 (which is wrong), 5^2 = 5^4; 5^3 = 5^8 ...
Strange :-/
Also: Do you think you could implement extracting the square/cubic root of a value (^0.5 and ^0.333.....)

Happy new year,
whiterock
  • 0

#15 sporefan

sporefan

    GMC Member

  • GMC Member
  • 22 posts
  • Version:GM:Studio

Posted 08 January 2012 - 06:11 PM

needs a bigint_round(number 1) function...
edit: o its rounds anyway ;p

Edited by sporefan, 04 April 2012 - 06:52 PM.

  • 0

fresh meat from the yygf <-- still havn't updated it.