# Calculation of large digit-plz help

Ka Tanaka

Greenhorn

Posts: 1

John Lee

Ranch Hand

Posts: 2545

posted 14 years ago

I think if it is longer than long type, what you can do is to define your own function:

1) treat them as string, read in one character at a time.

2) use character comparision to get the number value, then use the normal number calculation.

3) use a loop to calculate every digit from right to left.

4) then depend on what you want as result. If you want string, then you can transform the result back to string again. Or you can use formula below to represent the number value.

N = d_0 * 10^0 + d_1 * 10^1 + ... + d_n * 10^n

HTH.

1) treat them as string, read in one character at a time.

2) use character comparision to get the number value, then use the normal number calculation.

3) use a loop to calculate every digit from right to left.

4) then depend on what you want as result. If you want string, then you can transform the result back to string again. Or you can use formula below to represent the number value.

N = d_0 * 10^0 + d_1 * 10^1 + ... + d_n * 10^n

HTH.

John Lee

Ranch Hand

Posts: 2545

Jim Yingst

Wanderer

Sheriff

Sheriff

Posts: 18671