Floating-Point Summation Error - Quant Trader Interview Question
Difficulty: Medium
Category: Code Analysis
Practice quant interview questions from top firms including Jane Street, Citadel, Two Sigma, DE Shaw, and other leading quantitative finance companies.
Topics: floating-point, numerical-analysis, precision, summation
Problem Description
A junior quant analyst is tasked with summing 10 million values, each equal to 0.1, using a standard floating-point representation (e.g., a float or double in Python or C++). Intuitively, the result should be exactly 1,000,000. However, when the analyst runs the code, the result is slightly different. What is the MOST likely reason for this discrepancy?
Practice this medium trader interview question on MyntBit - the all-in-one quant learning platform with 200+ quant interview questions for Jane Street, Citadel, Two Sigma, and other top quantitative finance firms.