發新話題

[分享] 《分享》 PHP 『BC高精準度函式庫』

《分享》 PHP 『BC高精準度函式庫』

《分享》 PHP 『BC高精準度函式庫』bcadd --- 將二個高精準度數字相加
bcadd

(PHP3 , PHP4)

bcadd ---  將二個高精準度數字相加

語法 : string bcadd(string left operand, string right operand [ , int scale] );

說明 :

將參數left operand與right operand相加,傳回的字串為相加的和。參數scale是非必需的,scale是用來設定傳回的值到小數點第幾位。

參考 : bcsub( )



[ 本帖最後由 蔡逸竹 於 2006-9-19 22:09 編輯 ]

TOP

《分享》 PHP 『BC高精準度函式庫』bccomp --- 比較二個高精準度數字

bccomp

(PHP3 , PHP4)

bccomp ---  比較二個高精準度數字

語法 : int bccomp(string left operand, string right operand [ , int scale] );

說明 :

比較參數left operand與right operand,且傳回值為整數。參數scale是非必需的,scale是用來設定傳回的值到小數點第幾位。若二個數相等則傳回值為0,若left operand大於right operand則傳回值為+1,若left operand小於right operand則傳回值為-1。

TOP

《分享》 PHP 『BC高精準度函式庫』bcdiv --- 將二個高精準度數字相除

bcdiv

(PHP3 , PHP4)

bcdiv ---  將二個高精準度數字相除

語法 : string bcdiv(string left operand, string right operand [ , int scale] );

說明 :

將參數left operand除以right operand,且傳回結果。參數scale是非必需的,scale是用來設定傳回的值到小數點第幾位。

參考 : bcmul( )

TOP

《分享》 PHP 『BC高精準度函式庫』bcmod --- 取得高精準度數字的餘數

bcmod

(PHP3 , PHP4)

bcmod ---  取得高精準度數字的餘數

語法 : string bcmod(string left operand, string modulus);

說明 :

傳回參數modulus除以left operand後的餘數。

參考 : bcdiv( )

TOP

《分享》 PHP 『BC高精準度函式庫』bcmul --- 將二個高精準度數字相乘

bcmul

(PHP3 , PHP4)

bcmul ---  將二個高精準度數字相乘

語法 : string bcmul(string left operand, string right operand [ , int scale] );

說明 :

將left operand與right operand相乘,且傳回結果。參數scale是非必需的,scale是用來設定傳回的值到小數點第幾位。

參考 : bcdiv( )

TOP

《分享》 PHP 『BC高精準度函式庫』bcpow --- 求高精準度數字的次方值

bcpow

(PHP3 , PHP4)

bcpow ---  求高精準度數字的次方值

語法 : string bcpow(string x, string y [ , int scale] );

說明 :

傳回參數x的y次方項的值。參數scale是非必需的,scale是用來設定傳回的值到小數點第幾位。

參考 : bcsqrt( )

TOP

《分享》 PHP 『BC高精準度函式庫』bcscale --- 設定小數點位數

bcscale

(PHP3 , PHP4)

bcscale ---  設定小數點位數

語法 : string bcscale(int scale);

說明 :

此函式用來設定傳回值小數點的位數給所有隨後的BC高精準度函式使用,若隨後的函式無明確指定傳回值小數點的位數,則使用此函式所設定的值。

TOP

《分享》 PHP 『BC高精準度函式庫』bcsqrt --- 取得高精準度數字的平方根

bcsqrt

(PHP3 , PHP4)

bcsqrt ---  取得高精準度數字的平方根

語法 : string bcsqrt(string operand, int scale);

說明 :

傳回參數operand平方根的值。參數scale是非必需的,scale是用來設定傳回的值到小數點第幾位。

參考 : bcpow( )

TOP

《分享》 PHP 『BC高精準度函式庫』bcsub --- 將二個高精準度數字相減

bcsub

(PHP3 , PHP4)

bcsub ---  將二個高精準度數字相減

語法 : string bcsub(string left operand, string right operand [ , int scale] );

說明 :

將參數left operand減掉right operand,且傳回相減後的值。參數scale是非必需的,scale是用來設定傳回的值到小數點第幾位。

參考 : bcadd( )

TOP

發新話題

本站所有圖文均屬網友發表,僅代表作者的觀點與本站無關,如有侵權請通知版主會盡快刪除。