I need to work with values larger than what can be fit into the 32 bit long available in the compiler. I can store the values in 5 byte arrays, but I need user interaction via a numeric dispaly and keypad. I need to be able to convert value stored in the array to and from decimal ASCII representations. The built in functions don't appear to offer any help as they will not work with values greater than a long. Can anyone show me how I might do the conversion in assembly. I'm thinking about a function similar to atoul()that returns a pointer to an array and another to do the inverse conversion.
The library functions offer a lot of help.
Hint: If all you have is a pen and a paper: what are the largest numbers you can add together?
What are the largest numbers you can multiply?
What are the largest numbers you can divide?
In short, you can either write or download a multi-precision library. Then you can juse "any" length of integers.
The multi-precision library may store the data in decimal form, with the value 0..9 in every byte. That gives slow add/sub/mul/div operations, but instant conversion to a printable number.
Or the library may store the data as 0..255 in each byte, giving faster operations on the numbers but more work to convert to decimal.
You can even define a "virtual" decimal point int the numbers, giving you fixed-point numbers with any number of decimals (up to the available memory).
I need to work with values larger than what can be fit into the 32 bit long I really wonder what you can be doing with a precision like this.
or are you confusing resolution with precision?
or is it that you have not heard of scaling?
Erik
Neither. I'm talking about magnitudes that exceed 4294967295.
I'm talking about magnitudes that exceed 4294967295.
And you're sure you need a resolution of 1.0 with that?
Yes, I'm sure.
Then we are sure that float will not solve your problem!
And you're sure you need a resolution of 1.0 with that? Yes, I'm sure why so secretive, what is it
What math functions do you need?
for N bytes to Add add byteA[0] to byteB[0] add the carry to byte byteA[1] + byteB[1] and continue.
Try a search for "bignum" there are several multibyte math libraries available. You may have to port it to the 8052