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


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

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

Math::BigInt模塊的bnan()方法用於創建值為NAN的新對象,如果用於現有對象,則將其轉換為NAN。

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

參數:無參數

返回:NAN(非數字)

範例1:

#!/usr/bin/perl   
    
# Import Math::BigInt module  
use Math::BigInt;  
    
# Specify number  
$num = 78215936043546;  
    
# Create BigInt object  
$x = Math::BigInt->new($num);  
  
# Object before function call 
print("Before function call:$x\n");  
  
# Calling the function 
$x->bnan(); 
  
# Object after function call 
print("After function call:$x");
輸出:
Before function call:78215936043546
After function call:NaN

範例2:

#!/usr/bin/perl   
    
# Import Math::BigInt module  
use Math::BigInt;  
   
# Create a BigInt object  
$x = Math::BigInt->bnan(); 
  
# Object created with bnan() 
print("$x");
輸出:
NaN


相關用法


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