This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Display values larger than a long.

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.

Parents
  • 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).

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

Children