Comment

Comment by victorstanciu

You can use two integers, one that represents the entire number including decimals, and one that represents the precision, to know how many decimals are there. For example, you'd represent "123.45" as 12345 and 2. That's often how monetary amounts are stored in databases, to avoid a lot of common floating-point arithmetic pitfalls.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton