Are there any good JavaScript currency or decimal classes?

前端 未结 7 2429
孤城傲影
孤城傲影 2021-02-19 06:57

I am trying to deal with JavaScript values such as 23.45, but I want to be able to do mathematical operations on these values (addition, subtraction, multiplication

7条回答
  •  -上瘾入骨i
    2021-02-19 07:23

    Integers.

    There is no need to use floating-point for currency. Use fixed-point, where the number of decimal points is 0.

    You count in pennies (or possibly in tenths of pennies).

提交回复
热议问题