很困惑为什么我没有得到预期的金额?
我有 1 个结果,我将在银行帐户中收到该结果,根据该帐户,我必须将余额存入用户帐户。
如何从总尝试次数 491.50 / 0.95 = 517.36 中找到错误的处理成本?应该是 500.00(根据我的预期)
用户余额需要 500.00 当选择 500.00 时,他可以获得 5% 的折扣 这有一个处理成本,
ex:
1) Discount: 500.00 - 5% = 475.00
2) Handling cost: (475.00 x 0.034) + 0.35 = 16.50
3) Total: 475.00 + 16.50 = 491.50
所以问题是从 491.50 开始的,我必须找到至少处理成本才能获得承诺的余额。
有什么解决办法吗?我自己无法弄清楚......
简而言之: a) 我输入 491.50 -> b) 我的公式会建议我应用余额 500.00(这是主要目标)
I have 1 result and which i will receive in Bank account, Based on that account i have to Put a balance to user account.
How can you find the Handling cost from total tried 491.50 / 0.95 = 517.36 which is wrong ? It should be 500.00 (to my expectation)
User balance requires 500.00
When 500.00 selected he gets 5% discount
There is a handling cost for this
ex:
1) Discount: 500.00 - 5% = 475.00
2) Handling cost: (475.00 x 0.034) + 0.35 = 16.50
3) Total: 475.00 + 16.50 = 491.50
So problem is from 491.50, i have to find atleast handling cost to get promised Balance.
Any solution ? Cant figure it out myself...
In short cut:
a) i put 491.50 -> b) my formula will suggest me apply balance 500.00 (which is the main goal)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
因此,您的数学可以表示为:
((0.95 * initialCost * 0.034) + 0.35) + (0.95 * initialCost ) = FinalCost
减少为
(0.9823 * initialCost) + 0.35 = FinalCost
由此得出
initialCost = (finalCost - 0.35) / 0.9823
So, your maths can be represented as:
((0.95 * initialCost * 0.034) + 0.35) + (0.95 * initialCost ) = finalCost
which reduces to
(0.9823 * initialCost) + 0.35 = finalCost
It follows that
initialCost = (finalCost - 0.35) / 0.9823
(final_price - 0.35) / 1.034 / 0.95
对于 491.50,结果为 500。
您可以尝试将最后 2 个除法结合起来除以 1.034 * 0.95 = 0.9823,但您必须防止由于使用浮点运算而导致的舍入错误。
(final_price - 0.35) / 1.034 / 0.95
For 491.50, this yields 500.
You might try to combine the last 2 divisions to be divide by 1.034 * 0.95 = 0.9823, but you will have to guard against rounding errors due to using floating point arithmetic.