如何乘以2位小数并具有良好的等效值 [英] How do I multiply 2 decimals and having the good equivalent

查看:120
本文介绍了如何乘以2位小数并具有良好的等效值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有4个带有2位数字的小数字段,A,B,C和D.当我试图将A * B乘以并将它们放入C时,C和D应该等于但它们不是。

使用小数字段的最佳做法是什么?



我尝试过:



示例:

我们有A = 3.34,B = 4.97,C = 16.60,D = 16.59并且来自验证规则我试图检查C和D是否等于但我没有这种情况,但实际上它们应该是等于。

提前谢谢。

解决方案

实际上

 A * B = 16.5998 



现在你得到

 C = 16.60 

如果你结果转换为2 nd 小数。



另一方面,如果截断结果为2 nd 小数,则得到

 C = 16.59 


Hi, I have 4 Decimals fields with 2 digits, A, B, C and D. When I tried to multiply A*B and put them into C the C and D should be equals but they are not.
What is the best practice to use the Decimal Fields ?

What I have tried:

Example:
We have A=3.34, B=4.97, C=16.60, D=16.59 and from the Validation Rule I tried to check if the C and D are equals but I did not have the case, but actually they should be equals.
Thank you in advance.

解决方案

Actually

A*B = 16.5998


Now you get

C = 16.60

if you round the result to the 2nd decimal.

On the other hand, you get

C = 16.59

if you truncate the result to the 2nd decimal.


这篇关于如何乘以2位小数并具有良好的等效值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆