免費論壇 繁體 | 簡體
公告:SCLUB雲端專屬主機己開放租用
分享
MT4程式(Program)專業代寫服務(請email:letgofortrading@gmail.com) 警告:文章內容可能有大便,不喜請勿入。請不要像動物一樣,不歡迎也請勿自行進來找碴和找大便。私人網頁,後果請自行負責~
返回列表 發帖

Amibroker如何在小數點後第3個進行四捨五入

例如: 1.2345 -> 1.235

function cRound( value, decplaces )
{
    exponential = exp( log( 10 ) * decplaces );
    rounded = int( value * exponential + 0.5 ) / exponential;
    return rounded;
}

function cPrec( value, decplaces )
{
    return Prec( value + 5*10^-(decplaces+1), decplaces );
}

printf( "round1: %g", cRound( 1.2345, 3 ) );
printf( "\nround2: %g", cPrec( 1.2345, 3 ) );




function cPrec( value, decplaces )
{
    return Prec( value + 5*10^-(decplaces+1), decplaces );
}
!qqconnect:connect_viewthread_share_title!: !qqconnect:connect_viewthread_share_to_qzone!!qqconnect:connect_viewthread_share_to_qzone! !qqconnect:connect_viewthread_share_to_weibo!!qqconnect:connect_viewthread_share_to_weibo! !qqconnect:connect_viewthread_share_to_pengyou!!qqconnect:connect_viewthread_share_to_pengyou!
LMAX 顛覆外匯交易經驗/擊敗所有外匯經紀商

返回列表