Floating-Point Surprises

Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.

The problem

  • medium
  • Pro

A checkout adds ten pence and twenty pence and the test expecting thirty pence fails, because the result is a tiny bit more than point three. Explain why JavaScript numbers behave like this, and how you'd handle money safely.

Talk this problem through with an AI coach

This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.

Start free →