API Testing · Middle · Question 37 of 75
Why are monetary amounts often sent as strings or integers of cents?
- 1JSON doesn't support any numbers with decimal points
- 2Floating-point numbers can't represent many decimals exactly
- 3Strings are always faster to parse than numbers
Show the answer
Correct answer: Floating-point numbers can't represent many decimals exactly
Explanation
0.1 + 0.2 isn't exactly 0.3 in floating point. Testers check rounding, currency and totals.