如何解决这个模运算符javascript不准确的问题?

How to solve this problem of inaccurate modulus operators javascript?

有办法解决这个问题吗?我已经在控制台上试过了,结果是错误的,但从技术上讲,结果是正确的

控制台实验:

使用Math.floor()

console.log(Math.floor(1%0.01)===0)

In C and C++, the remainder operator accepts only integral operands; in ECMAScript, it also accepts floating-point operands. ECMA Standands

%运算符计算的浮点取余运算结果与“余数”不同 IEEE 754-2008 定义的操作。

The IEEE 754-2008 “remainder” operation computes the remainder from a rounding division, not a truncating division, and so its behaviour is not analogous to that of the usual integer remainder operator.

console.log(Math.floor(1%0.01)===0)

相反,ECMAScript 语言定义了浮点运算的 % 以某种方式运行 类似于 Java 整数余数运算符;这可以与 C 库函数 fmod 进行比较。