I wrote a program calculating powers of two and using "unsigned long" data type. But still after the number 2^32 (which means 4294961665) it rolls back to one.
Is this number the maximum number i can deal with?
Any ideas?
I wrote a program calculating powers of two and using "unsigned long" data type. But still after the number 2^32 (which means 4294961665) it rolls back to one.
Is this number the maximum number i can deal with?
Any ideas?
Is this number the maximum number i can deal with?
No.
You can use a long long and get a 64 bit value.
After that assuming you don't want to go with float you will have to implement multi byte arithmetic to what ever precision you want. It is not as difficult as it sounds.
so 2^64 will be the max value then??
Yes with long long but with float:-
http://arduino.cc/it/Reference/Float
you can get:-
Floating-point numbers can be as large as 3.4028235E+38 and as low as -3.4028235E+38.
Floats have only 6-7 decimal digits of precision.
Then you have to start doing some work your self.
It is simple enough to implement two or more long longs to represent a number.