![](/img/trans.png)
[英]How to round a double to two decimals through Formatting, then using the number afterwards?
[英]How to round number to 2 decimals
在幫助同伴的路上,我什至不知道這種語言的存在,編寫了一個簡單的F腳本
http://forums.marketcircle.com/eve/forums/a/tpc/f/2931083693/m/883106236
但是我試圖找到一種方法將數字四舍五入到小數點后兩位,但沒有發現任何問題。
有人可以幫我完成我的幫助嗎? 謝謝你
腳本是:
"Get amount to use from API"
amountEur := element valueForKeyPath:'parent.reportData.object.subtotalPlusMarkupMinusDiscount'.
"Let's convert to EEK"
amountEEK := amountEur / 15.6466.
"Return the value"
amountEEK.
回答后的工作腳本
"Get amount to use from API"
amountEur := element valueForKeyPath:'parent.reportData.object.subtotalPlusMarkupMinusDiscount'.
"Let's convert to EEK"
amountEEK := amountEur / 15.6466.
"Floor it"
floorEEK := ((amountEEK * 100) + 0.5) floor.
"Return the value"
floorEEK / 100.
如果沒有本機回合函數,則應該可以使用:
乘以100,乘以底,再除以100。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.