[priority: high] Floating point precision errors in mana and time displays #196
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
BUG: Floating point arithmetic causes ugly display values
Bug Summary
Multiple UI displays show raw JavaScript floating point precision errors instead of clean rounded numbers.
Affected Areas
1. Elemental Mana Pools display
1.1360000000000008/10instead of1.14/102. Debug Time display
Day 1, Hour 13.119999999999896instead ofHour 13.123. Duplicate "Base Regen" label with inconsistent formatting
Expected Behavior
Investigation Needed
toFixed(),Math.round(), or number formatting utilitiesPriority
HIGH - Affects readability and polish of core UI
Starting investigation of floating point precision errors in mana/time displays.
Additional affected locations found during playtesting:
1.7120000000000013/10instead of a clean value — same floating-point precision bug as the Stats tab Elemental Mana Pools display.Current: 57.691520000000054 / 100— the raw float is displayed without rounding.Day 1, Hour 8.5599999999999993— same issue as the Time Control display in the bug report.All three are the same root cause: raw JavaScript floating-point values being rendered without
toFixed()or rounding. These are additional locations to fix when addressing this issue, not separate bugs.Fixed three floating point display issues:
Elemental Mana Pools (ElementStatsSection.tsx): Raw state.current/state.max values now formatted with fmtDec(state.current, 2) / fmtDec(state.max, 0) to show clean 2-decimal values.
Debug Time display (GameStateDebug.tsx): Hour value now displayed with hour.toFixed(2) instead of raw float.
Duplicate "Base Regen" label (ManaStatsSection.tsx): Renamed the second occurrence to "Computed Base Regen" to distinguish it from the base value.
All 917 tests pass.