當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


perl Math::BigInt->config()用法及代碼示例

Math::BigIntPerl中的module提供了代表具有任意精度的整數和重載算術運算符的對象。

Math::BigInt模塊的config()方法用於獲取有關Perl模塊的配置的信息。

用法: Math::BigInt->config()

參數:沒有

返回:包含配置的哈希,例如類名,版本號,庫等

範例1:

#!/usr/bin/perl  
  
# Import Data Dumper Module 
use Data::Dumper; 
  
# Import Math::BigInt module  
use Math::BigInt;  
  
print Dumper(Math::BigInt->config()); 
  
print Math::BigInt->config()->{version}, "\n";
輸出:
$VAR1 = {
          'precision' => undef,
          'upgrade' => undef,
          'accuracy' => undef,
          'div_scale' => 40,
          'trap_nan' => 0,
          'lib_version' => '1.9997',
          'trap_inf' => 0,
          'version' => '1.9997',
          'round_mode' => 'even',
          'lib' => 'Math::BigInt::Calc',
          'class' => 'Math::BigInt',
          'downgrade' => undef
        };
1.9997

範例2:

#!/usr/bin/perl  
  
# Import Data Dumper Module 
use Data::Dumper; 
  
# Import Math::BigInt module  
use Math::BigInt;  
  
print Dumper(Math::BigInt->config()); 
  
print Math::BigInt->config()->{lib}, "\n";
輸出:
$VAR1 = {
          'lib' => 'Math::BigInt::Calc',
          'class' => 'Math::BigInt',
          'accuracy' => undef,
          'upgrade' => undef,
          'round_mode' => 'even',
          'div_scale' => 40,
          'trap_nan' => 0,
          'lib_version' => '1.9997',
          'version' => '1.9997',
          'precision' => undef,
          'trap_inf' => 0,
          'downgrade' => undef
        };
Math::BigInt::Calc


相關用法


注:本文由純淨天空篩選整理自Code_Mech大神的英文原創作品 Perl | Math::BigInt->config() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。