Better HN
topnewbestaskshowjobs
Log inSign up

ktowen

2 karma · joined Apr 26, 2022 (4y ago) · 6 submissions

Submissions

comment 3y ago · link · parent

I will not be using numbers smaller than 0.0001

comment 3y ago · link · parent

I will only be doing operations with numbers with max 4 decimal places

comment 3y ago · link · parent

The idea is rounding the result of operations with JS float numbers, float 0.1025 * 14 should give 1.435 but gives 1.4349999999999998 and when I try to round to 2 decimal places it will give 1.43 instead of 1.44

comment 3y ago · link · parent

Sorry about that, I thought I found an error that made it worthless but was an error in other area

5.

Ask HN: Is double-rounding valid for JS floating point precision at 2 decimals?

3 points · by ktowen · 3y ago · 10 comments