珀尔 | Math::BigInt->bnan() 方法
Perl 中的Math::BigInt
模块提供了表示具有任意精度和重载算术运算运算符的整数的对象。
Math::BigInt
模块的bnan()方法用于创建一个值为 NAN 的新对象,如果用于现有对象,则将其转换为 NAN。
Syntax: Math::BigInt->bnan()
Parameter: No Parameter
Returns: NAN(Not A Number)
示例 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