Page 1 of 1

Working with large numbers?

Posted: Mon Jun 21, 2010 12:22 am
by Ondra
Good day all. I have a project where I need to manipulate, store and transmit large number values. 99,999,999 is the largest value.
Can I use a floating point variable?
Can floating point store a number that large?

Also I need to store this value in the eeprom mem.
Can one space hold such a large value?
If not how can this be done?

Thanks in advance

Ondra

Re: Working with large numbers?

Posted: Mon Jun 21, 2010 12:30 pm
by Benj
Hello Ondra,

A float variable should be long enough but will involve using the Float manipulation functions and also include the large floating point libraries in your program. A better way would be to use a 32-bit long C variable as this is an integer so all the additional float support material is not required.

eg.

unsigned long number = 99999999;

A long can handle a max of 0 to 4294967296 or -2147483648 to 2147483647 if you leave out the unsigned command.

Please refer to David's article for help with storing and retrieving the value from the EEPROM.

http://www.matrixmultimedia.com/mmforum ... =26&t=7451