select round(round(610948.05/72720,15)*36360,2) from dual;Oracle中得到的值:305474.02
Excel中得到的值: 305474.03
delphi/VB中得到的值:305474.03select round(round(529690.75/18368,15)*9184,2) from dual;Oracle中得到的值:264845.37
Excel中得到的值: 264845.38
delphi/VB中得到的值: 264845.38
怎么样能够使Oracle得到的值与下面两种一致?
Excel中得到的值: 305474.03
delphi/VB中得到的值:305474.03select round(round(529690.75/18368,15)*9184,2) from dual;Oracle中得到的值:264845.37
Excel中得到的值: 264845.38
delphi/VB中得到的值: 264845.38
怎么样能够使Oracle得到的值与下面两种一致?
试试,结果应该是一样的,四舍五入的
scott@YPCOST> select round(round(610948.05/72720,16)*36360,2) from dual;ROUND(ROUND(610948.05/72720,16)*36360,2)
----------------------------------------
305474.03scott@YPCOST> select round(round(529690.75/18368,18)*9184,2) from dual;ROUND(ROUND(529690.75/18368,18)*9184,2)
---------------------------------------
264845.38
305474.03select round(round(610948.05/72720,15)*36360,2) from dual;
305474.02
select round(floor(round(610948.05/72720,15)*36360*100),2)/100 from dual;试试,但是可能都会多出1来,看看行不啊,呵呵
610948.05/72720=8.4013758250825082508250825082508
取15位8.401375825082508
8.401375825082508*36360= 305474.02499999999088
四舍五入就是305474.02
感觉楼主应该确认下Delphi里是如何计算
得到的还是305474.02,与Excel算的不一样。
windows计算器的精度也是很高的,与Oracle一样。但是Delphi和VB中存放在Double变量中就不一样了,即使不存放在Double中,直接返回也是这样。
delphi和VB中的计算应该有错的。你可以检查一下其中的代码。
round(610948.05/72720,18)*
怀疑你是在用不同的精度在计算,结果不同很正常吧。
SQL> select round(610948.05*36360/72720,2) from dual;
ROUND(610948.05*36360/72720,2)
------------------------------
305474.03
SQL>