General Coding Question
#1

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?
Reply
#2

I'd use double.... 8 bytes, 64 bits
Reply
#3

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)