需要获得乘数,将一美分的一小部分变为一整美分
我希望能够在 php 应用程序中指定百分之一的分数(最大值为 100)。我需要计算出需要多少次迭代才能达到偶数整分。我继承了一个据说可以执行此操作的应用程序,但它根本不起作用。有人可以指出我的方向吗?如果这太简单了,我深表歉意。我只是一片空白。在我们的应用程序中,它做了这样的事情:
$integerPayout = (int)floor($payout * 10000);
$count = 1;
$modAmount = 100;
while(($integerPayout * $count) % $modAmount != 0)
$count += 1;
echo $count;
I want to be able to specify a fraction of a cent (100th max) in a php application. I need to figure out how many iterations it would take to reach an even whole cent. I inherited an application that was supposedly doing this, but it's not working at all. Is there any direction someone can point me in? I apologize if this is beyond simple. I am just blanking out. In our app, it was doing something like this:
$integerPayout = (int)floor($payout * 10000);
$count = 1;
$modAmount = 100;
while(($integerPayout * $count) % $modAmount != 0)
$count += 1;
echo $count;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
lcm
(100 , (int)($payout * 100)) / (int)($payout * 100)
lcm
(100, (int)($payout * 100)) / (int)($payout * 100)