Javascript multiplying incorrectly, causing incorrect rounding

后端 未结 3 1916
名媛妹妹
名媛妹妹 2021-01-02 23:54

When I pull the values I want to multiply, they\'re strings. So I pull them, parse them as floats (to preserve the decimal places), and multiply them together.



        
3条回答
  •  太阳男子
    2021-01-03 00:31

    You might find the Accounting.js library useful for this. It has an "improved" toFixed() method.

提交回复
热议问题