如果一個數無法除盡 例如 10/3 把它分成2部分 3.33*2 + 3.34 這樣2位小數的 怎么做 能除盡的 超過2位小數的 5/8 也分成2份 0.62*4 0.63*4
應該如何實作
uj5u.com熱心網友回復:
10*100=1000;1000 div 3 =333;
x:=333*(3-1);
y:=1000-x;
a:=strtofloat(formatfloat('0.00',x/100));
b:=strtofloat(formatfloat('0.00',y/100));
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/250359.html
標籤:語言基礎/算法/系統設計
