相关疑难解决方法(0)

如何将小数简化为最小可能的分数?

例如,如果我的函数被调用getlowestfraction(),这就是我期望它做的:

getlowestfraction(0.5) // returns 1, 2 or something along the lines of that
Run Code Online (Sandbox Code Playgroud)

另一个例子:

getlowestfraction(0.125) // returns 1, 8 or something along the lines of that
Run Code Online (Sandbox Code Playgroud)

javascript math function

2
推荐指数
1
解决办法
2500
查看次数

标签 统计

function ×1

javascript ×1

math ×1