179k views
5 votes
Add Big Numbers Take two positive numbers as strings, and return the sum of them. E.g. "3.14" + "0.9" => "4.04". Please note: Simply converting the strings to numbers and adding them together or utilizing Big Decimal is not acceptable and will not get full credit for the assessment. The solution must work for numbers that are very large as well.

1 Answer

5 votes

Final answer:

When adding big numbers, keep track of decimal places and significant figures. In scientific notation, ensure exponents are the same before adding.

Step-by-step explanation:

When adding big numbers, it is important to keep track of significant figures and decimal places. In addition and subtraction, the answer should have the same number of decimal places as the number with the fewest decimal places. For example, 13.2 + 12.252 = 25.452 can be rounded to 25.5 to keep one decimal place.

In multiplication and division, the answer should have the same number of significant figures as the original number with the fewest significant figures. For example, 1.35 x 2.1 = 2.835 can be rounded to 2.8.

It is important to note that in scientific notation, both exponents must have the same value before adding the numbers together.

User Aegatlin
by
8.9k points