Perl | Math::BigInt->bneg() method
Last Updated :
03 Oct, 2019
Math::BigInt
module in Perl provides objects that represent integers with arbitrary precision and overloaded arithmetical operators.
bneg() method of Math::BigInt
module is used to change the value of input to its negative value and does nothing for zero or NAN values
Syntax: Math::BigInt->bneg()
Parameter: No Parameter
Returns: object with value negated value
Example 1:
use Math::BigInt;
$num = 78215936043546;
$x = Math::BigInt->new( $num );
$x ->bneg();
print ( $x );
|
Example 2:
use Math::BigInt;
$num = -78215936043546;
$x = Math::BigInt->new( $num );
$x ->bneg();
print ( $x );
|
Example 3:
use Math::BigInt;
$num = 0;
$num1 = NaN;
$x = Math::BigInt->new( $num );
$y = Math::BigInt->new( $num1 );
$x ->bneg();
$y ->bneg();
print ( "$x\n" );
print ( $y );
|
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...