Numbers bigger than 1,000,000,000

Hi,
I need to make a program which can handle variable larger than 1,000,000,000 for addition. The problem with integers is that I start getting 1.0E09 which I don't want. I tried to make them string but then I can't do simple addition with numbers like v=v+10 it would say "type mismatch". Any suggestions. Thanks in advance.

You can stretch it some by using #

Integers are limited to -32768 to 32767 but double precision numbers go much further. You can also use DIM x as DOUBLE at the top of your program as in:

DIM x as DOUBLE
INPUT x
PRINT x + x
END

Double precision will give you up to 15-digits to use for the sum of your numbers. Beyond that, you would need to convert with strings and a function to add together. I know you stated integers, which means you could use long (&) but double allows for larger integers than long does, even though it 'doubles' for decimal numbers.

Personally, I always like to convert to strings for most applications to avoid other problems but if this gets you by for what you need, great. I would like to know what type of project you are working on and if you need some help in the future, just post the code you have so far and ask for help where you are stuck?

Oops, I forgot

July 5 2008, 11:01 AM

GENERIC GALLEON COMPILER IS NOT READY YET AND I'M NOT SUPPOSED TO MENTION IT IN THIS FORUM AND EVEN THOUGH IT USUALLY GETS BETTER WITH EACH DEMO WHICH IS USUALLY RELEASED EVERY MONTH (A MONTH ON THE THIRD PLANET FROM THE SUN ("EARTH") IS ONE TWELFTH-PART OF THE TIME IT TAKES FOR THE PLANET TO REVOLVE AROUND THE SUN, WHICH IS USUALLY THIRTY TIMES THE TIME IT TAKES FOR THE PLANET TO ROTATE ON ITS AXIS), YOU MIGHT TRY IT AND GIVE UP ON IT AND NEVER USE IT AGAIN. DO NOT EAT QB64.

Important number at the end.

July 5 2008, 11:56 AM

Thanks for the response on both website. I actually need the last digits so I can't have E at all. Even if there was a way to print as a number (not with E) after all the additions that would have worked too.
Thanks again

adddecstr

April 20 2011, 11:18 PM

adddecstr adds two non-negative integers, in the form of strings. The result is stored in the first string. The strings should contain only ASCII decimal numerals in big-endian order. It should work with input strings up to 32766 bytes long, but I haven't tested it with strings that big.

addbinstr

This function is similar to the other one in a few ways, but also different in a few ways.

Like the other one, it accepts two input strings of basically any lengths. Like the other one, it stores the result in the first string.

In this case, the string is not a sequence of decimal numerals in big-endian order, but is a little-endian unsigned integer of arbitrary size.

Note that in this function, as well as in the last, the two input strings can be different lengths. The first one, since it will store the result, is expanded to the size of the larger string, plus 1, to accommodate a possible carry. Afterward, leading zeros are removed. In the case of the other function, 0 becomes "0". In the case of this function, 0 becomes "", an empty string.