I wrote a program to multiply or add any two numbers where neither is negative or has a decimal. It's the equivalent of pen and paper arithmetic, so it's slow but at GameSpeed 40 it can multiply two 155 digit numbers 100 times in under a minute and is never wrong.
I don't -really- need to use numbers beyond maybe 20 digits each or do it very often, my only concern is that when I script to multiply or add two numbers the answer is never wrong. Normally ints will be wrong beyond â€"2,147,483,648 to 2,147,483,647 and I cannot trust floats. I don't need to use negative numbers or decimals at this point.
I've come up with better ways to multiply, subtract and divide, but I'm stuck on addition because carrying is slow and I can't find many resources on how to do that quicker.
I'm mostly just looking for tips or hints at this point. Maybe someone's already had to do this and come up with ways how?
I don't -really- need to use numbers beyond maybe 20 digits each or do it very often, my only concern is that when I script to multiply or add two numbers the answer is never wrong. Normally ints will be wrong beyond â€"2,147,483,648 to 2,147,483,647 and I cannot trust floats. I don't need to use negative numbers or decimals at this point.
I've come up with better ways to multiply, subtract and divide, but I'm stuck on addition because carrying is slow and I can't find many resources on how to do that quicker.
I'm mostly just looking for tips or hints at this point. Maybe someone's already had to do this and come up with ways how?