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
Working with large numbers?
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Working with large numbers?
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
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
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel