Math::BigInt
Perl中的module提供了代表具有任意精度的整數和重載算術運算符的對象。
Math::BigInt模塊的from_oct()方法用於將作為輸入傳遞的八進製數轉換為其相應的十進製數。
用法: Math::BigInt->from_oct()
參數:輸入要轉換的八進製數
返回:傳遞的八進製數的相應十進製數
範例1:
#!/usr/bin/perl
# Import Math::BigInt module
use Math::BigInt;
# Converting from octal to decimal
$x = Math::BigInt->from_oct("0345");
print("$x\n");
# Converting from octal to decimal
$x = Math::BigInt->from_oct("_443");
print("$x\n");
輸出:
229 291
範例2:
#!/usr/bin/perl
# Import Math::BigInt module
use Math::BigInt;
# Converting negative number
# from octal to decimal
$x = Math::BigInt->from_oct("-0345");
print("$x\n");
# Converting negative number
# from octal to decimal
$x = Math::BigInt->from_oct("-_443");
print("$x\n");
輸出:
-229 -291
相關用法
- perl Math::BigInt->bzero()用法及代碼示例
- perl Math::BigInt->is_odd()用法及代碼示例
- perl Math::BigInt->brsft()用法及代碼示例
- perl Math::BigInt->length()用法及代碼示例
- perl Math::BigInt->config()用法及代碼示例
- perl Math::BigInt->from_hex()用法及代碼示例
- perl Math::BigInt->bneg()用法及代碼示例
- perl Math::BigInt->bnan()用法及代碼示例
- perl Math::BigInt->digit()用法及代碼示例
- perl Math::BigInt->binf()用法及代碼示例
- perl Math::BigInt->bone()用法及代碼示例
- perl Math::BigInt->bfac()用法及代碼示例
注:本文由純淨天空篩選整理自Code_Mech大神的英文原創作品 Perl | Math::BigInt->from_oct() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。