SPVM::NumberUtil - Number Utilities
use SPVM::NumberUtil; my $int8_max = SPVM::NumberUtil->INT8_MAX(); my $int16_max = SPVM::NumberUtil->INT16_MAX(); my $int32_max = SPVM::NumberUtil->INT32_MAX(); my $int64_max = SPVM::NumberUtil->INT64_MAX(); my $rand = SPVM::NumberUtil->rand();
Number utilities.
sub INT8_MIN : byte ()
Return -128. The minimal value of the signed 8bit integer.
INT8_MAX : byte ()
Return 127. The maximum value of the signed 8bit integer.
sub INT16_MIN : short ()
Return -32768. The minimal value of the signed 16bit integer.
sub INT16_MAX : short ()
Return 32767. The maximum value of the signed 16bit integer .
sub INT32_MIN : int ()
Return -2147483648. The minimal value of the signed 32bit integer.
sub INT32_MAX : int ()
Return 2147483647. The maximum value of the signed 32bit integer.
sub INT64_MIN : long ()
Return -9223372036854775808. The minimal value of signed 64bit integer.
sub INT64_MAX : long ()
Return 9223372036854775807. The maximum value of the signed 64bit integer.
sub UINT8_MAX : byte ()
Return -1. The same bit expression of 0xFF in the unsigned 8bit integer in 2's complement.
sub UINT16_MAX : short ()
Return -1. The same bit expression of 0xFFFF in the unsigned 16bit integer in 2's complement.
sub UINT32_MAX : int ()
Return -1. The same bit expression of 0xFFFFFFFF in the unsigned 32bit integer in 2's complement.
sub UINT64_MAX : long ()
Return -1. The same bit expression of 0xFFFFFFFFFFFFFFFF in the unsigned 64bit integer in 2's complement.
sub FLT_MIN : float ()
Return the value of FLT_MIN macro defined in float.h C header.
sub FLT_MAX : float ()
Return the value of FLT_MAX macro defined in float.h C header.
sub DBL_MIN : double ()
Return the value of DBL_MIN macro defined in float.h C header.
sub DBL_MAX : double ()
Return the value of DBL_MAX macro defined in float.h C header.
sub crand : int ();
Get random number(0 <= rundom_number <= SPVM::NumberUtil->RAND_MAX). This is same as rand function of C language.
The first seed is initialized by epoch time automatically. If you set a seed manually, you can use <srand> static method.
This method is not thread safe because internaly this method use rand function of C language.
sub rand : double ();
Get random number(0 <= random_number < 1). This is same as rand function of Perl language.
sub srand : void ($seed : long);
Sets random number seed for the crand or rand static method.
crand
rand
To install SPVM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SPVM
CPAN shell
perl -MCPAN -e shell install SPVM
For more information on module installation, please visit the detailed CPAN module installation guide.