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

Name

SPVM::Math - Mathematical Functions

Description

The Math class of SPVM has methods for mathematical functions.

Usage

  use Math;
  
  my $sin = Math->sin(Math->PI / 4);

Class Methods

abs

  static method abs : int ($x : int);

Gets the abusolute value of the int value $x.

acos

  static method acos : double ($x : double);

Calls the acos function of the C language defined in math.h.

acosf

  static method acosf : float ($x : float);

Calls the acosf function of the C language defined in math.h.

acosh

  static method acosh : double ($x : double);

Calls the acosh function of the C language defined in math.h.

acoshf

  static method acoshf : float ($x : float);

Calls the acoshf function of the C language defined in math.h.

asin

  static method asin : double ($x : double);

Calls the asin function of the C language defined in math.h.

asinf

  static method asinf : float ($x : float);

Calls the asinf function of the C language defined in math.h.

asinh

  static method asinh : double ($x : double);

Calls the asinh function of the C language defined in math.h.

asinhf

  static method asinhf : float ($x : float);

Calls the asinhf function of the C language defined in math.h.

atan

  static method atan : double ($x : double);

Calls the atan function of the C language defined in math.h.

atan2

  static method atan2 : double ($y : double, $x : double);

Calls the atan2 function of the C language defined in math.h.

atanf

  static method atanf : float ($x : float);

Calls the atanf function of the C language defined in math.h.

atanh

  static method atanh : double ($x : double);

Calls the atanh function of the C language defined in math.h.

atanhf

  static method atanhf : float ($x : float);

Calls the atanhf function of the C language defined in math.h.

cabs

  static method cabs : double ($z : Complex_2d);

Calls the cabs function of the C language defined in complex.h.

cabsf

  static method cabsf : float ($z : Complex_2f);

Calls the cabsf function of the C language defined in complex.h.

cacos

  static method cacos : Complex_2d ($z : Complex_2d);

Calls the cacos function of the C language defined in complex.h.

cacosf

  static method cacosf : Complex_2f ($z : Complex_2f);

Calls the cacosf function of the C language defined in complex.h.

cacosh

  static method cacosh : Complex_2d ($z : Complex_2d);

Calls the cacosh function of the C language defined in complex.h.

cacoshf

  static method cacoshf : Complex_2f ($z : Complex_2f);

Calls the cacoshf function of the C language defined in complex.h.

cadd

  static method cadd : Complex_2d ($z1 : Complex_2d, $z2 : Complex_2d);

Calls the cadd function of the C language defined in complex.h.

caddf

  static method caddf : Complex_2f ($z1 : Complex_2f, $z2 : Complex_2f);

Calls the caddf function of the C language defined in complex.h.

carg

  static method carg : double ($z : Complex_2d);

Calls the carg function of the C language defined in complex.h.

cargf

  static method cargf : float ($z : Complex_2f);

Calls the cargf function of the C language defined in complex.h.

casin

  static method casin : Complex_2d ($z : Complex_2d);

Calls the casin function of the C language defined in complex.h.

casinf

  static method casinf : Complex_2f ($z : Complex_2f);

Calls the casinf function of the C language defined in complex.h.

casinh

  static method casinh : Complex_2d ($z : Complex_2d);

Calls the casinh function of the C language defined in complex.h.

casinhf

  static method casinhf : Complex_2f ($z : Complex_2f);

Calls the casinhf function of the C language defined in complex.h.

catan

  static method catan : Complex_2d ($z : Complex_2d);

Calls the catan function of the C language defined in complex.h.

catanf

  static method catanf : Complex_2f ($z : Complex_2f);

Calls the catanf function of the C language defined in complex.h.

catanh

  static method catanh : Complex_2d ($z : Complex_2d);

Calls the catanh function of the C language defined in complex.h.

catanhf

  static method catanhf : Complex_2f ($z : Complex_2f);

Calls the catanhf function of the C language defined in complex.h.

cbrt

  static method cbrt : double ($x : double);

Calls the cbrt function of the C language defined in math.h.

cbrtf

  static method cbrtf : float ($x : float);

Calls the cbrtf function of the C language defined in math.h.

ccos

  static method ccos : Complex_2d ($z : Complex_2d);

Calls the ccos function of the C language defined in complex.h.

ccosf

  static method ccosf : Complex_2f ($z : Complex_2f);

Calls the ccosf function of the C language defined in complex.h.

ccosh

  static method ccosh : Complex_2d ($z : Complex_2d);

Calls the ccosh function of the C language defined in complex.h.

ccoshf

  static method ccoshf : Complex_2f ($z : Complex_2f);

Calls the ccoshf function of the C language defined in complex.h.

cdiv

  static method cdiv : Complex_2d ($z1 : Complex_2d, $z2 : Complex_2d);

double complex division.

cdivf

  static method cdivf : Complex_2f ($z1 : Complex_2f, $z2 : Complex_2f);

float complex division.

ceil

  static method ceil : double ($x : double);

Calls the ceil function of the C language defined in math.h.

ceilf

  static method ceilf : float ($x : float);

Calls the ceilf function of the C language defined in math.h.

cexp

  static method cexp : Complex_2d ($z : Complex_2d);

Calls the cexp function of the C language defined in complex.h.

cexpf

  static method cexpf : Complex_2f ($z : Complex_2f);

Calls the cexpf function of the C language defined in complex.h.

clog

  static method clog : Complex_2d ($z : Complex_2d);

Calls the clog function of the C language defined in complex.h.

clogf

  static method clogf : Complex_2f ($z : Complex_2f);

Calls the clogf function of the C language defined in complex.h.

cmul

  static method cmul : Complex_2d ($z1 : Complex_2d, $z2 : Complex_2d);

Calculates the product($z1 * $z2) of double complex numbers.

cmulf

  static method cmulf : Complex_2f ($z1 : Complex_2f, $z2 : Complex_2f);

Calculates the product($z1 * $z2) of float complex numbers.

complex

  static method complex : Complex_2d ($x : double, $y : double);

Creates a double complex value of the Complex_2d type.

complexf

  static method complexf : Complex_2f ($x : float, $y : float);

Creates a float complex value of the Complex_2f type.

conj

  static method conj : Complex_2d ($z : Complex_2d);

Calls the conj function of the C language defined in complex.h.

conjf

  static method conjf : Complex_2f ($z : Complex_2f);

Calls the conjf function of the C language defined in complex.h.

copysign

  static method copysign : double ($x : double, $y : double);

Calls the copysign function of the C language defined in math.h.

copysignf

  static method copysignf : float ($x : float, $y : float);

Calls the copysignf function of the C language defined in math.h.

cos

  static method cos : double ($x : double);

Calls the cos function of the C language defined in math.h.

cosf

  static method cosf : float ($x : float);

Calls the cosf function of the C language defined in math.h.

cosh

  static method cosh : double ($x : double);

Calls the cosh function of the C language defined in math.h.

coshf

  static method coshf : float ($x : float);

Calls the coshf function of the C language defined in math.h.

cpow

  static method cpow : Complex_2d ($z1 : Complex_2d, $z2 : Complex_2d);

Calls the cpow function of the C language defined in complex.h.

cpowf

  static method cpowf : Complex_2f ($z1 : Complex_2f, $z2 : Complex_2f);

Calls the cpowf function of the C language defined in complex.h.

cscamul

  static method cscamul : Complex_2d ($c : double, $z : Complex_2d);

Calculates the scalar product($c * $z) of the double complex, and returns it.

cscamulf

  static method cscamulf : Complex_2f ($c : float, $z : Complex_2f);

Calculates the scalar product($c * $z) of the float complex, and returns it.

csin

  static method csin : Complex_2d ($z : Complex_2d);

Calls the csin function of the C language defined in complex.h.

csinf

  static method csinf : Complex_2f ($z : Complex_2f);

Calls the csinf function of the C language defined in complex.h.

csinh

  static method csinh : Complex_2d ($z : Complex_2d);

Calls the csinh function of the C language defined in complex.h.

csinhf

  static method csinhf : Complex_2f ($z : Complex_2f);

Calls the csinhf function of the C language defined in complex.h.

csqrt

  static method csqrt : Complex_2d ($z : Complex_2d);

Calls the csqrt function of the C language defined in complex.h.

csqrtf

  static method csqrtf : Complex_2f ($z : Complex_2f);

Calls the csqrtf function of the C language defined in complex.h.

csub

  static method csub : Complex_2d ($z1 : Complex_2d, $z2 : Complex_2d);

Calls the csub function of the C language defined in complex.h.

csubf

  static method csubf : Complex_2f ($z1 : Complex_2f, $z2 : Complex_2f);

Calls the csubf function of the C language defined in complex.h.

ctan

  static method ctan : Complex_2d ($z : Complex_2d);

Calls the ctan function of the C language defined in complex.h.

ctanf

  static method ctanf : Complex_2f ($z : Complex_2f);

Calls the ctanf function of the C language defined in complex.h.

ctanh

  static method ctanh : Complex_2d ($z : Complex_2d);

Calls the ctanh function of the C language defined in complex.h.

ctanhf

  static method ctanhf : Complex_2f ($z : Complex_2f);

Calls the ctanhf function of the C language defined in complex.h.

E

  static method E : double ();

Returns the Euler's number e. This value is 0x1.5bf0a8b145769p+1.

erf

  static method erf : double ($x : double);

Calls the erf function of the C language defined in math.h.

erfc

  static method erfc : double ($x : double);

Calls the erfc function of the C language defined in math.h.

erfcf

  static method erfcf : float ($x : float);

Calls the erfcf function of the C language defined in math.h.

erff

  static method erff : float ($x : float);

Calls the erff function of the C language defined in math.h.

exp

  static method exp : double ($x : double);

Calls the exp function of the C language defined in math.h.

exp2

  static method exp2 : double ($x : double);

Calls the exp2 function of the C language defined in math.h.

exp2f

  static method exp2f : float ($x : float);

Calls the exp2f function of the C language defined in math.h.

expf

  static method expf : float ($x : float);

Calls the expf function of the C language defined in math.h.

expm1

  static method expm1 : double ($x : double);

Calls the expm1 function of the C language defined in math.h.

expm1f

  static method expm1f : float ($x : float);

Calls the expm1f function of the C language defined in math.h.

fabs

  static method fabs : double ($x : double);

Calls the fabs function of the C language defined in math.h.

fabsf

  static method fabsf : float ($x : float);

Calls the fabsf function of the C language defined in math.h.

fdim

  static method fdim : double ($x : double, $y : double);

Calls the fdim function of the C language defined in math.h.

fdimf

  static method fdimf : float ($x : float, $y : float);

Calls the fdimf function of the C language defined in math.h.

FE_DOWNWARD

  static method FE_DOWNWARD : int ();

Calls the FE_DOWNWARD macro of the C language defined in fenv.h.

FE_TONEAREST

  static method FE_TONEAREST : int ();

Calls the FE_TONEAREST macro of the C language defined in fenv.h.

FE_TOWARDZERO

  static method FE_TOWARDZERO : int ();

Calls the FE_TOWARDZERO macro of the C language defined in fenv.h.

FE_UPWARD

  static method FE_UPWARD : int ();

Calls the FE_UPWARD macro of the C language defined in fenv.h.

fesetround

  static method fesetround : int ($round : int);

Calls the fesetround function of the C language defined in math.h.

floor

  static method floor : double ($x : double);

Calls the floor function of the C language defined in math.h.

floorf

  static method floorf : float ($x : float);

Calls the floorf function of the C language defined in math.h.

fma

  static method fma : double ($x : double, $y : double, $x3 : double);

Calls the fma function of the C language defined in math.h.

fmaf

  static method fmaf : float ($x : float, $y : float, $x3 : float);

Calls the fmaf function of the C language defined in math.h.

fmax

  static method fmax : double ($x : double, $y : double);

Calls the fmax function of the C language defined in math.h.

fmaxf

  static method fmaxf : float ($x : float, $y : float);

Calls the fmaxf function of the C language defined in math.h.

fmin

  static method fmin : double ($x : double, $y : double);

Calls the fmin function of the C language defined in math.h.

fminf

  static method fminf : float ($x : float, $y : float);

Calls the fminf function of the C language defined in math.h.

fmod

  static method fmod : double ($x : double, $y : double);

Calls the fmod function of the C language defined in math.h.

fmodf

  static method fmodf : float ($x : float, $y : float);

Calls the fmodf function of the C language defined in math.h.

FP_ILOGB0

  static method FP_ILOGB0 : int ();

Calls the FP_ILOGB0 macro of the C language defined in fenv.h.

FP_ILOGBNAN

  static method FP_ILOGBNAN : int ();

Calls the FP_ILOGBNAN macro of the C language defined in fenv.h.

FP_INFINITE

  static method FP_INFINITE : int ();

Calls the FP_INFINITE macro of the C language defined in fenv.h.

FP_NAN

  static method FP_NAN : int ();

Calls the FP_NAN macro of the C language defined in fenv.h.

FP_ZERO

  static method FP_ZERO : int ();

Calls the FP_ZERO macro of the C language defined in fenv.h.

fpclassify

  static method fpclassify : int ($x : double);

Calls the fpclassify macro of the C language defined in math.h with the double argument $x.

fpclassifyf

  static method fpclassifyf : int ($x : float);

Calls the fpclassify macro of the C language defined in math.h with the float argument $x.

frexp

  static method frexp : double ($x : double, $exp : int*);

Calls the frexp function of the C language defined in math.h.

frexpf

  static method frexpf : float ($x : float, $exp : int*);

Calls the frexpf function of the C language defined in math.h.

HUGE_VAL

  static method HUGE_VAL : double ();

Calls the HUGE_VAL macro of the C language defined in math.h.

HUGE_VALF

  static method HUGE_VALF : float ();

Calls the HUGE_VALF macro of the C language defined in math.h.

hypot

  static method hypot : double ($x : double, $y : double);

Calls the hypot function of the C language defined in math.h.

hypotf

  static method hypotf : float ($x : float, $y : float);

Calls the hypotf function of the C language defined in math.h.

ilogb

  static method ilogb : int ($x : double);

Calls the ilogb function of the C language defined in math.h.

ilogbf

  static method ilogbf : int ($x : float);

Calls the ilogbf function of the C language defined in math.h.

INFINITY

  static method INFINITY : double ();

Calls the INFINITY macro of the C language defined in math.h, and returns the return value as a dobule value.

INFINITYF

  static method INFINITYF : float ();

Calls the INFINITY macro of the C language defined in math.h, and the return value as a float value.

isfinite

  static method isfinite : int ($x : double);

Calls the isfinite macro of the C language defined in math.h with the double argument $x.

isfinitef

  static method isfinitef : int ($x : float);

Calls the isfinite macro of the C language defined in math.h with the float argument $x.

isgreater

  static method isgreater : int ($x : double, $y : double);

Calls the isgreater macro of the C language defined in math.h with the double arguments $x and $y.

isgreaterequal

  static method isgreaterequal : int ($x : double, $y : double);

Calls the isgreaterequal macro of the C language defined in math.h with the double arguments $x and $y.

isgreaterequalf

  static method isgreaterequalf : int ($x : float, $y : float);

Calls the isgreaterequal macro of the C language defined in math.h with the float arguments $x and $y.

isgreaterf

  static method isgreaterf : int ($x : float, $y : float);

Calls the isgreater macro of the C language defined in math.h with the float arguments $x and $y.

isinf

  static method isinf : int ($x : double);

Calls the isinf macro of the C language defined in math.h with the double argument $x.

isinff

  static method isinff : int($x : float);

Calls the isinf macro of the C language defined in math.h with the float argument $x.

isless

  static method isless : int ($x : double, $y : double);

Calls the isless macro of the C language defined in math.h with the double arguments $x and $y.

islessequal

  static method islessequal : int ($x : double, $y : double);

Calls the islessequal macro of the C language defined in math.h with the double arguments $x and $y.

islessequalf

  static method islessequalf : int ($x : float, $y : float);

Calls the islessequalf macro of the C language defined in math.h with the float arguments $x and $y.

islessf

  static method islessf : int ($x : float, $y : float);

Calls the islessf macro of the C language defined in math.h with the float arguments $x and $y.

islessgreater

  static method islessgreater : int ($x : double, $y : double);

Calls the islessgreater macro of the C language defined in math.h with the double arguments $x and $y.

islessgreaterf

  static method islessgreaterf : int ($x : float, $y : float);

Calls the islessgreater macro of the C language defined in math.h with the float arguments $x and $y.

isnan

  static method isnan : int ($x : double);

Calls the isnan macro of the C language defined in math.h with the double argument $x.

isnanf

  static method isnanf : int ($x : float);

Calls the isnanf macro of the C language defined in math.h with the float argument $x.

isunordered

  static method isunordered : int ($x : double, $y : double);

Calls the isunordered macro of the C language defined in math.h with the double arguments $x and $y.

isunorderedf

  static method isunorderedf : int ($x : float, $y : float);

Calls the isunorderedf macro of the C language defined in math.h with the float arguments $x and $y.

labs

  static method labs : long ($x : long);

Returns the abusolute value of the long value $x.

ldexp

  static method ldexp : double ($x : double, $exp : int);

Calls the ldexp function of the C language defined in math.h.

ldexpf

  static method ldexpf : float ($x : float, $exp : int);

Calls the ldexpf function of the C language defined in math.h.

lgamma

  static method lgamma : double ($x : double);

Calls the lgamma function of the C language defined in math.h.

lgammaf

  static method lgammaf : float ($x : float);

Calls the lgammaf function of the C language defined in math.h.

log

  static method log : double ($x : double);

Calls the log function of the C language defined in math.h.

log10

  static method log10 : double ($x : double);

Calls the log10 function of the C language defined in math.h.

log10f

  static method log10f : float ($x : float);

Calls the log10f function of the C language defined in math.h.

log1p

  static method log1p : double ($x : double);

Calls the log1p function of the C language defined in math.h.

log1pf

  static method log1pf : float ($x : float);

Calls the log1pf function of the C language defined in math.h.

log2

  static method log2 : double ($x : double);

Calls the log2 function of the C language defined in math.h.

log2f

  static method log2f : float ($x : float);

Calls the log2f function of the C language defined in math.h.

logb

  static method logb : double ($x : double);

Calls the logb function of the C language defined in math.h.

logbf

  static method logbf : float ($x : float);

Calls the logbf function of the C language defined in math.h.

logf

  static method logf : float ($x : float);

Calls the logf function of the C language defined in math.h.

lround

  static method lround : long ($x : double);

Calls the llround function of the C language defined in math.h.

lroundf

  static method lroundf : long ($x : float);

Calls the llroundf function of the C language defined in math.h.

modf

  static method modf : double ($x : double, $intpart : double*);

Calls the modf function of the C language defined in math.h.

modff

  static method modff : float ($x : float, $intpart : float*);

Calls the modff function of the C language defined in math.h.

NAN

  static method NAN : double ();

Calls the NAN macro of the C language defined in math.h, and return the return value as a double type.

nan

  static method nan : double ($string : string);

Calls the nan function of the C language defined in math.h.

Exceptions:

The $string must be defined. Otherwise an exception is thrown.

NANF

  static method NANF : float ();

Calls the NAN macro of the C language defined in math.h, and return the return value as a float type.

nanf

  static method nanf : float ($string : string);

Calls the nanf function of the C language defined in math.h.

Exceptions:

The $string must be defined. Otherwise an exception is thrown.

nearbyint

  static method nearbyint : double ($x : double);

Calls the nearbyint function of the C language defined in math.h.

nearbyintf

  static method nearbyintf : float ($x : float);

Calls the nearbyintf function of the C language defined in math.h.

nextafter

  static method nextafter : double ($x : double, $y : double);

Calls the nextafter function of the C language defined in math.h.

nextafterf

  static method nextafterf : float ($x : float, $y : float);

Calls the nextafterf function of the C language defined in math.h.

nexttoward

  static method nexttoward : double ($x : double, $y : double);

Calls the nexttoward function of the C language defined in math.h.

nexttowardf

  static method nexttowardf : float ($x : float, $y : double);

Calls the nexttowardf function of the C language defined in math.h.

PI

  static method PI : double ();

Returns pi. This value is 0x1.921fb54442d18p+1.

pow

  static method pow : double ($x : double, $y : double);

Calls the pow function of the C language defined in math.h.

powf

  static method powf : float ($x : float, $y : float);

Calls the powf function of the C language defined in math.h.

remainder

  static method remainder : double ($x : double, $y : double);

Calls the remainder function of the C language defined in math.h.

remainderf

  static method remainderf : float ($x : float, $y : float);

Calls the remainderf function of the C language defined in math.h.

remquo

  static method remquo : double ($x : double, $y : double, $quo : int*);

Calls the remquo function of the C language defined in math.h.

remquof

  static method remquof : float ($x : float, $y : float, $quo : int*);

Calls the remquof function of the C language defined in math.h.

round

  static method round : double ($x : double);

Calls the round function of the C language defined in math.h.

roundf

  static method roundf : float ($x : float);

Calls the roundf function of the C language defined in math.h.

scalbln

  static method scalbln : double ($x : double, $exp : long);

Calls the scalbln function of the C language defined in math.h.

scalblnf

  static method scalblnf : float ($x : float, $exp : long);

Calls the scalblnf function of the C language defined in math.h.

scalbn

  static method scalbn : double ($x : double, $exp : int);

Calls the scalbn function of the C language defined in math.h.

scalbnf

  static method scalbnf : float ($x : float, $exp : int);

Calls the scalbnf function of the C language defined in math.h.

signbit

  static method signbit : int ($x : double);

Calls the signbit function of the C language defined in math.h.

signbitf

  static method signbitf : int ($x : float);

Calls the signbitf function of the C language defined in math.h.

sin

  static method sin : double ($x : double);

Calls the sin function of the C language defined in math.h.

sinf

  static method sinf : float ($x : float);

Calls the sinf function of the C language defined in math.h.

sinh

  static method sinh : double ($x : double);

Calls the sinh function of the C language defined in math.h.

sinhf

  static method sinhf : float ($x : float);

Calls the sinhf function of the C language defined in math.h.

sqrt

  static method sqrt : double ($x : double);

Calls the sqrt function of the C language defined in math.h.

sqrtf

  static method sqrtf : float ($x : float);

Calls the sqrtf function of the C language defined in math.h.

tan

  static method tan : double ($x : double);

Calls the tan function of the C language defined in math.h.

tanf

  static method tanf : float ($x : float);

Calls the tanf function of the C language defined in math.h.

tanh

  static method tanh : double ($x : double);

Calls the tanh function of the C language defined in math.h.

tanhf

  static method tanhf : float ($x : float);

Calls the tanhf function of the C language defined in math.h.

tgamma

  static method tgamma : double ($x : double);

Calls the tgamma function of the C language defined in math.h.

tgammaf

  static method tgammaf : float ($x : float);

Calls the tgammaf function of the C language defined in math.h.

trunc

  static method trunc : double ($x : double);

Calls the trunc function of the C language defined in math.h.

truncf

  static method truncf : float ($x : float);

Calls the truncf function of the C language defined in math.h.

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License