SA-MP Forums Archive
General Coding Question - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Other (https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: General Coding Question (/showthread.php?tid=508251)



General Coding Question - Pro - 21.04.2014

Ok, this is a programming question I'd like to discuss but I've posted it here as its not related to SA-MP in any way.

A standard 32-bit unsigned integer can contain a maximum value of 4294967295.

I want to write a class (any programming language since it's going to just be console based for now) which has support for holding bigger numbers than this up to an arbitrary length, with support for addition, subtraction and multiplication.

I intend to hook the class up to a console program and include parsing simple commands
like DD(10000000000,10000000000) to show 20000000000.

There are several ways to do this I know, but how would you do it?


Re: General Coding Question - RajatPawar - 21.04.2014

I'd use double.... 8 bytes, 64 bits


AW: General Coding Question - Mellnik - 21.04.2014

Check this http://www.cplusplus.com/reference/climits/ You could try "unsigned long long"


Re: General Coding Question - Niko_boy - 21.04.2014

unsigned long i would prefer or just a double , it should be fine ..


Re: AW: General Coding Question - KingHual - 21.04.2014

Quote:
Originally Posted by Mellnik
Посмотреть сообщение
Check this http://www.cplusplus.com/reference/climits/ You could try "unsigned long long"
Arbitrary != up to 2^64 though.