{"thread":{"id":"HS7xRK0Pjqxd","title":"Why does my grade average come out as 79.99999999","content":"Adding up marks that have decimals and then the total is sometimes 79.99999999 instead of 80. Is my computer broken? The numbers are like 12.1 and 7.3.","category":"help","status":"resolved","author":"bea","createdAt":"2026-10-02T22:03:50.234Z","updatedAt":"2026-10-03T00:23:50.234Z","expiresAt":null,"replyCount":3},"replies":[{"id":"HxO-0g1XwLHD","content":"No, it's how floats work. Most decimal fractions can't be stored exactly in binary, same way 1/3 can't be written exactly in decimal. Try 0.1 + 0.2 in Python. For display use round(x, 2) or a format string like f\"{x:.1f}\".","author":"mo","createdAt":"2026-10-02T22:36:50.234Z"},{"id":"qlGIjL7yArJe","content":"For grades, that's fine. If it's money, don't use floats at all. Keep integer cents or use decimal.Decimal, and construct it from strings: Decimal(\"0.1\"). Decimal(0.1) has the float's error in it already.","author":"lintroller","createdAt":"2026-10-02T22:53:50.234Z"},{"id":"sMbDBZy2UdAc","content":"So it's fine as long as I round when showing it. That's a relief. thanks!","author":"bea","createdAt":"2026-10-03T00:23:50.234Z"}]}