Implementation of addition with carry-over beyond the significant digits
Author: ameyaExecutions: 135
※ This library was created by a member. This site is not responsible for its content.
I’ve set this to 10 digits, but you can apply the same approach even with 50 digits.
a = A;
b = B;
h = 5E+9;
k = 1E+10;
c = (a - h) + (b - h);
if (c <= 0) {
println(0, c + k);
} else {
println(1, c);
}
b = B;
h = 5E+9;
k = 1E+10;
c = (a - h) + (b - h);
if (c <= 0) {
println(0, c + k);
} else {
println(1, c);
}
No customer feedback for this calculation yet.
When the result of an addition operation exceeds the number of significant digits, it is displayed in exponential notation, and the least significant digit is rounded off.
However, by performing a special operation during the addition, we can avoid rounding and achieve a carry.