The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

SPVM::CORE - SPVM Standard Functions

SPVM Standard Functions

FUNCTIONS

print

Print string to stdout.

  sub print : void ($string : string);

warn

Print string with file name and line number to stderr. line break is added to end of string.

  sub warn : void ($string : string);

time

Get epoch time.

  sub time : long ();

INFINITYF

  sub INFINITYF : float ()

NANF

  sub NANF : float ()
  

isinff

  sub isinff : int($x : float)

isfinitef

  sub isfinitef : int($x : float)

isnanf

  sub isnanf : int ($x : float)
  

INFINITY

  sub INFINITY : double ()

NAN

  sub NAN : double ()
  

isinf

  sub isinf : int ($x : double)

isfinite

  sub isfinite : int ($x : double)

isnan

  sub isnan : int ($x : double)

E

sub E : double ()

The double value that is closer than any other to e, the base of the natural logarithms.

PI

sub PI : double ()

The double value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter.

sin

sub sin : double ($x : double)

Returns the trigonometric sine of an angle. Special cases:

    =item* If the argument is NaN or an infinity, then the result is NaN.

    =item* If the argument is zero, then the result is a zero with the same sign as the argument.

The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

Parameters:

$x - an angle, in radians.

Returns:

the sine of the argument.

cos

sub cos : double ($x : double)

Returns the trigonometric cosine of an angle. Special cases:

    =item* If the argument is NaN or an infinity, then the result is NaN.

The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

Parameters:

$x - an angle, in radians.

Returns:

the cosine of the argument.

tan

sub tan : double ($x : double)

Returns the trigonometric tangent of an angle. Special cases:

    =item* If the argument is NaN or an infinity, then the result is NaN.

    =item* If the argument is zero, then the result is a zero with the same sign as the argument.

The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

Parameters:

$x - an angle, in radians.

Returns:

the tangent of the argument.

asin

sub asin : double ($x : double)

Returns the arc sine of a value; the returned angle is in the range -pi/2 through pi/2. Special cases:

  • If the argument is NaN or its absolute value is greater than 1, then the result is NaN.

  • If the argument is zero, then the result is a zero with the same sign as the argument.

    The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

    Parameters:

    $x - the value whose arc sine is to be returned.

    Returns:

    the arc sine of the argument.

acos

sub acos : double ($x : double)

Returns the arc cosine of a value; the returned angle is in the range 0.0 through pi. Special case:

  • If the argument is NaN or its absolute value is greater than 1, then the result is NaN.

The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

Parameters:

$x - the value whose arc cosine is to be returned.

Returns:

the arc cosine of the argument.

atan

sub atan : double ($x : double)

Returns the arc tangent of a value; the returned angle is in the range -pi/2 through pi/2. Special cases:

  • If the argument is NaN, then the result is NaN.

  • If the argument is zero, then the result is a zero with the same sign as the argument.

The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

Parameters:

$x - the value whose arc tangent is to be returned.

Returns:

the arc tangent of the argument.

erf

  sub erf : double ($x : double);

erfc

  sub erfc : double ($x : double);

INT8_MIN

sub INT8_MIN : byte ()

INT8_MAX

INT8_MAX : byte ()

INT16_MIN

sub INT16_MIN : short ()

INT16_MAX

sub INT16_MAX : short ()

INT32_MIN

sub INT32_MIN : int ()

INT32_MAX

sub INT32_MAX : int ()

INT64_MIN

sub INT64_MIN : long ()

INT64_MAX

sub INT64_MAX : long ()

FLT_MIN

sub FLT_MIN : float ()

FLT_MAX

sub FLT_MAX : float ()

DBL_MIN

sub DBL_MIN : double ()

DBL_MAX

sub DBL_MAX : double ()

copy_string

sub copy_string : string ($string : string)

  my $string = "abced";
  my $string_copy = copy_string $string;

Copy string.

copy_byte_array

sub copy_byte_array : byte[] ($nums : byte[])

  my $nums = [(byte)1, 2, 3];
  my $nums_copy = copy_byte_array $nums;
  

Copy byte array.

copy_short_array

sub copy_short_array : short[] ($nums : short[])

  my $nums = [(short)1, 2, 3];
  my $nums_copy = copy_short_array $nums;

Copy short array.

copy_int_array

sub copy_int_array : int[] ($nums : int[])

  my $nums = [1, 2, 3];
  my $nums_copy = copy_int_array $nums;

Copy int array.

copy_long_array

sub copy_long_array : long[] ($nums : long[])

  my $nums = [(long)1, 2, 3];
  my $nums_copy = copy_long_array $nums;

Copy long array.

copy_float_array

sub copy_float_array : float[] ($nums : float[])

  my $nums = [0.5f, 0.25f, 0.3f];
  my $nums_copy = copy_float_array $nums;

Copy float array.

copy_double_array

sub copy_double_array : double[] ($nums : double[])

  my $nums = [0.5, 0.25, 0.3];
  my $nums_copy = copy_double_array $nums;

Copy double array.

copy_object_array

sub copy_object_array : object[] ($objects : object[])

  my $objects = [(object)SPVM::Int->new(1), SPVM::Int->new(2), SPVM::Int->new(3)];
  my $objects_copy = copy_object_array $objects;

Copy object array.

Array is sharrow copy, not deeply copy.