SPVM::Math - Mathematical Functions
The Math class of SPVM has methods for mathematical functions.
use Math; my $sin = Math->sin(Math->PI / 4);
static method abs : int ($x : int);
Gets the abusolute value of the int value $x.
static method acos : double ($x : double);
Calls the acos function of the C language defined in math.h.
acos
math.h
static method acosf : float ($x : float);
Calls the acosf function of the C language defined in math.h.
acosf
static method acosh : double ($x : double);
Calls the acosh function of the C language defined in math.h.
acosh
static method acoshf : float ($x : float);
Calls the acoshf function of the C language defined in math.h.
acoshf
static method asin : double ($x : double);
Calls the asin function of the C language defined in math.h.
asin
static method asinf : float ($x : float);
Calls the asinf function of the C language defined in math.h.
asinf
static method asinh : double ($x : double);
Calls the asinh function of the C language defined in math.h.
asinh
static method asinhf : float ($x : float);
Calls the asinhf function of the C language defined in math.h.
asinhf
static method atan : double ($x : double);
Calls the atan function of the C language defined in math.h.
atan
static method atan2 : double ($y : double, $x : double);
Calls the atan2 function of the C language defined in math.h.
atan2
static method atanf : float ($x : float);
Calls the atanf function of the C language defined in math.h.
atanf
static method atanh : double ($x : double);
Calls the atanh function of the C language defined in math.h.
atanh
static method atanhf : float ($x : float);
Calls the atanhf function of the C language defined in math.h.
atanhf
static method cabs : double ($z : Complex_2d);
Calls the cabs function of the C language defined in complex.h.
cabs
complex.h
static method cabsf : float ($z : Complex_2f);
Calls the cabsf function of the C language defined in complex.h.
cabsf
static method cacos : Complex_2d ($z : Complex_2d);
Calls the cacos function of the C language defined in complex.h.
cacos
static method cacosf : Complex_2f ($z : Complex_2f);
Calls the cacosf function of the C language defined in complex.h.
cacosf
static method cacosh : Complex_2d ($z : Complex_2d);
Calls the cacosh function of the C language defined in complex.h.
cacosh
static method cacoshf : Complex_2f ($z : Complex_2f);
Calls the cacoshf function of the C language defined in complex.h.
cacoshf
static method cadd : Complex_2d ($z1 : Complex_2d, $z2 : Complex_2d);
Calls the cadd function of the C language defined in complex.h.
cadd
static method caddf : Complex_2f ($z1 : Complex_2f, $z2 : Complex_2f);
Calls the caddf function of the C language defined in complex.h.
caddf
static method carg : double ($z : Complex_2d);
Calls the carg function of the C language defined in complex.h.
carg
static method cargf : float ($z : Complex_2f);
Calls the cargf function of the C language defined in complex.h.
cargf
static method casin : Complex_2d ($z : Complex_2d);
Calls the casin function of the C language defined in complex.h.
casin
static method casinf : Complex_2f ($z : Complex_2f);
Calls the casinf function of the C language defined in complex.h.
casinf
static method casinh : Complex_2d ($z : Complex_2d);
Calls the casinh function of the C language defined in complex.h.
casinh
static method casinhf : Complex_2f ($z : Complex_2f);
Calls the casinhf function of the C language defined in complex.h.
casinhf
static method catan : Complex_2d ($z : Complex_2d);
Calls the catan function of the C language defined in complex.h.
catan
static method catanf : Complex_2f ($z : Complex_2f);
Calls the catanf function of the C language defined in complex.h.
catanf
static method catanh : Complex_2d ($z : Complex_2d);
Calls the catanh function of the C language defined in complex.h.
catanh
static method catanhf : Complex_2f ($z : Complex_2f);
Calls the catanhf function of the C language defined in complex.h.
catanhf
static method cbrt : double ($x : double);
Calls the cbrt function of the C language defined in math.h.
cbrt
static method cbrtf : float ($x : float);
Calls the cbrtf function of the C language defined in math.h.
cbrtf
static method ccos : Complex_2d ($z : Complex_2d);
Calls the ccos function of the C language defined in complex.h.
ccos
static method ccosf : Complex_2f ($z : Complex_2f);
Calls the ccosf function of the C language defined in complex.h.
ccosf
static method ccosh : Complex_2d ($z : Complex_2d);
Calls the ccosh function of the C language defined in complex.h.
ccosh
static method ccoshf : Complex_2f ($z : Complex_2f);
Calls the ccoshf function of the C language defined in complex.h.
ccoshf
static method cdiv : Complex_2d ($z1 : Complex_2d, $z2 : Complex_2d);
double complex division.
static method cdivf : Complex_2f ($z1 : Complex_2f, $z2 : Complex_2f);
float complex division.
static method ceil : double ($x : double);
Calls the ceil function of the C language defined in math.h.
ceil
static method ceilf : float ($x : float);
Calls the ceilf function of the C language defined in math.h.
ceilf
static method cexp : Complex_2d ($z : Complex_2d);
Calls the cexp function of the C language defined in complex.h.
cexp
static method cexpf : Complex_2f ($z : Complex_2f);
Calls the cexpf function of the C language defined in complex.h.
cexpf
static method clog : Complex_2d ($z : Complex_2d);
Calls the clog function of the C language defined in complex.h.
clog
static method clogf : Complex_2f ($z : Complex_2f);
Calls the clogf function of the C language defined in complex.h.
clogf
static method cmul : Complex_2d ($z1 : Complex_2d, $z2 : Complex_2d);
Calculates the product($z1 * $z2) of double complex numbers.
static method cmulf : Complex_2f ($z1 : Complex_2f, $z2 : Complex_2f);
Calculates the product($z1 * $z2) of float complex numbers.
static method complex : Complex_2d ($x : double, $y : double);
Creates a double complex value of the Complex_2d type.
static method complexf : Complex_2f ($x : float, $y : float);
Creates a float complex value of the Complex_2f type.
static method conj : Complex_2d ($z : Complex_2d);
Calls the conj function of the C language defined in complex.h.
conj
static method conjf : Complex_2f ($z : Complex_2f);
Calls the conjf function of the C language defined in complex.h.
conjf
static method copysign : double ($x : double, $y : double);
Calls the copysign function of the C language defined in math.h.
copysign
static method copysignf : float ($x : float, $y : float);
Calls the copysignf function of the C language defined in math.h.
copysignf
static method cos : double ($x : double);
Calls the cos function of the C language defined in math.h.
cos
static method cosf : float ($x : float);
Calls the cosf function of the C language defined in math.h.
cosf
static method cosh : double ($x : double);
Calls the cosh function of the C language defined in math.h.
cosh
static method coshf : float ($x : float);
Calls the coshf function of the C language defined in math.h.
coshf
static method cpow : Complex_2d ($z1 : Complex_2d, $z2 : Complex_2d);
Calls the cpow function of the C language defined in complex.h.
cpow
static method cpowf : Complex_2f ($z1 : Complex_2f, $z2 : Complex_2f);
Calls the cpowf function of the C language defined in complex.h.
cpowf
static method cscamul : Complex_2d ($c : double, $z : Complex_2d);
Calculates the scalar product($c * $z) of the double complex, and returns it.
static method cscamulf : Complex_2f ($c : float, $z : Complex_2f);
Calculates the scalar product($c * $z) of the float complex, and returns it.
static method csin : Complex_2d ($z : Complex_2d);
Calls the csin function of the C language defined in complex.h.
csin
static method csinf : Complex_2f ($z : Complex_2f);
Calls the csinf function of the C language defined in complex.h.
csinf
static method csinh : Complex_2d ($z : Complex_2d);
Calls the csinh function of the C language defined in complex.h.
csinh
static method csinhf : Complex_2f ($z : Complex_2f);
Calls the csinhf function of the C language defined in complex.h.
csinhf
static method csqrt : Complex_2d ($z : Complex_2d);
Calls the csqrt function of the C language defined in complex.h.
csqrt
static method csqrtf : Complex_2f ($z : Complex_2f);
Calls the csqrtf function of the C language defined in complex.h.
csqrtf
static method csub : Complex_2d ($z1 : Complex_2d, $z2 : Complex_2d);
Calls the csub function of the C language defined in complex.h.
csub
static method csubf : Complex_2f ($z1 : Complex_2f, $z2 : Complex_2f);
Calls the csubf function of the C language defined in complex.h.
csubf
static method ctan : Complex_2d ($z : Complex_2d);
Calls the ctan function of the C language defined in complex.h.
ctan
static method ctanf : Complex_2f ($z : Complex_2f);
Calls the ctanf function of the C language defined in complex.h.
ctanf
static method ctanh : Complex_2d ($z : Complex_2d);
Calls the ctanh function of the C language defined in complex.h.
ctanh
static method ctanhf : Complex_2f ($z : Complex_2f);
Calls the ctanhf function of the C language defined in complex.h.
ctanhf
static method E : double ();
Returns the Euler's number e. This value is 0x1.5bf0a8b145769p+1.
e
0x1.5bf0a8b145769p+1
static method erf : double ($x : double);
Calls the erf function of the C language defined in math.h.
erf
static method erfc : double ($x : double);
Calls the erfc function of the C language defined in math.h.
erfc
static method erfcf : float ($x : float);
Calls the erfcf function of the C language defined in math.h.
erfcf
static method erff : float ($x : float);
Calls the erff function of the C language defined in math.h.
erff
static method exp : double ($x : double);
Calls the exp function of the C language defined in math.h.
exp
static method exp2 : double ($x : double);
Calls the exp2 function of the C language defined in math.h.
exp2
static method exp2f : float ($x : float);
Calls the exp2f function of the C language defined in math.h.
exp2f
static method expf : float ($x : float);
Calls the expf function of the C language defined in math.h.
expf
static method expm1 : double ($x : double);
Calls the expm1 function of the C language defined in math.h.
expm1
static method expm1f : float ($x : float);
Calls the expm1f function of the C language defined in math.h.
expm1f
static method fabs : double ($x : double);
Calls the fabs function of the C language defined in math.h.
fabs
static method fabsf : float ($x : float);
Calls the fabsf function of the C language defined in math.h.
fabsf
static method fdim : double ($x : double, $y : double);
Calls the fdim function of the C language defined in math.h.
fdim
static method fdimf : float ($x : float, $y : float);
Calls the fdimf function of the C language defined in math.h.
fdimf
static method FE_DOWNWARD : int ();
Calls the FE_DOWNWARD macro of the C language defined in fenv.h.
FE_DOWNWARD
fenv.h
static method FE_TONEAREST : int ();
Calls the FE_TONEAREST macro of the C language defined in fenv.h.
FE_TONEAREST
static method FE_TOWARDZERO : int ();
Calls the FE_TOWARDZERO macro of the C language defined in fenv.h.
FE_TOWARDZERO
static method FE_UPWARD : int ();
Calls the FE_UPWARD macro of the C language defined in fenv.h.
FE_UPWARD
static method fesetround : int ($round : int);
Calls the fesetround function of the C language defined in math.h.
fesetround
static method floor : double ($x : double);
Calls the floor function of the C language defined in math.h.
floor
static method floorf : float ($x : float);
Calls the floorf function of the C language defined in math.h.
floorf
static method fma : double ($x : double, $y : double, $x3 : double);
Calls the fma function of the C language defined in math.h.
fma
static method fmaf : float ($x : float, $y : float, $x3 : float);
Calls the fmaf function of the C language defined in math.h.
fmaf
static method fmax : double ($x : double, $y : double);
Calls the fmax function of the C language defined in math.h.
fmax
static method fmaxf : float ($x : float, $y : float);
Calls the fmaxf function of the C language defined in math.h.
fmaxf
static method fmin : double ($x : double, $y : double);
Calls the fmin function of the C language defined in math.h.
fmin
static method fminf : float ($x : float, $y : float);
Calls the fminf function of the C language defined in math.h.
fminf
static method fmod : double ($x : double, $y : double);
Calls the fmod function of the C language defined in math.h.
fmod
static method fmodf : float ($x : float, $y : float);
Calls the fmodf function of the C language defined in math.h.
fmodf
static method FP_ILOGB0 : int ();
Calls the FP_ILOGB0 macro of the C language defined in fenv.h.
FP_ILOGB0
static method FP_ILOGBNAN : int ();
Calls the FP_ILOGBNAN macro of the C language defined in fenv.h.
FP_ILOGBNAN
static method FP_INFINITE : int ();
Calls the FP_INFINITE macro of the C language defined in fenv.h.
FP_INFINITE
static method FP_NAN : int ();
Calls the FP_NAN macro of the C language defined in fenv.h.
FP_NAN
static method FP_ZERO : int ();
Calls the FP_ZERO macro of the C language defined in fenv.h.
FP_ZERO
static method fpclassify : int ($x : double);
Calls the fpclassify macro of the C language defined in math.h with the double argument $x.
fpclassify
static method fpclassifyf : int ($x : float);
Calls the fpclassify macro of the C language defined in math.h with the float argument $x.
static method frexp : double ($x : double, $exp : int*);
Calls the frexp function of the C language defined in math.h.
frexp
static method frexpf : float ($x : float, $exp : int*);
Calls the frexpf function of the C language defined in math.h.
frexpf
static method HUGE_VAL : double ();
Calls the HUGE_VAL macro of the C language defined in math.h.
HUGE_VAL
static method HUGE_VALF : float ();
Calls the HUGE_VALF macro of the C language defined in math.h.
HUGE_VALF
static method hypot : double ($x : double, $y : double);
Calls the hypot function of the C language defined in math.h.
hypot
static method hypotf : float ($x : float, $y : float);
Calls the hypotf function of the C language defined in math.h.
hypotf
static method ilogb : int ($x : double);
Calls the ilogb function of the C language defined in math.h.
ilogb
static method ilogbf : int ($x : float);
Calls the ilogbf function of the C language defined in math.h.
ilogbf
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.
INFINITY
static method INFINITYF : float ();
Calls the INFINITY macro of the C language defined in math.h, and the return value as a float value.
static method isfinite : int ($x : double);
Calls the isfinite macro of the C language defined in math.h with the double argument $x.
isfinite
static method isfinitef : int ($x : float);
Calls the isfinite macro of the C language defined in math.h with the float argument $x.
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.
isgreater
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.
isgreaterequal
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.
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.
static method isinf : int ($x : double);
Calls the isinf macro of the C language defined in math.h with the double argument $x.
isinf
static method isinff : int($x : float);
Calls the isinf macro of the C language defined in math.h with the float argument $x.
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.
isless
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.
islessequal
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.
islessequalf
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.
islessf
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.
islessgreater
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.
static method isnan : int ($x : double);
Calls the isnan macro of the C language defined in math.h with the double argument $x.
isnan
static method isnanf : int ($x : float);
Calls the isnanf macro of the C language defined in math.h with the float argument $x.
isnanf
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.
isunordered
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.
isunorderedf
static method labs : long ($x : long);
Returns the abusolute value of the long value $x.
static method ldexp : double ($x : double, $exp : int);
Calls the ldexp function of the C language defined in math.h.
ldexp
static method ldexpf : float ($x : float, $exp : int);
Calls the ldexpf function of the C language defined in math.h.
ldexpf
static method lgamma : double ($x : double);
Calls the lgamma function of the C language defined in math.h.
lgamma
static method lgammaf : float ($x : float);
Calls the lgammaf function of the C language defined in math.h.
lgammaf
static method log : double ($x : double);
Calls the log function of the C language defined in math.h.
log
static method log10 : double ($x : double);
Calls the log10 function of the C language defined in math.h.
log10
static method log10f : float ($x : float);
Calls the log10f function of the C language defined in math.h.
log10f
static method log1p : double ($x : double);
Calls the log1p function of the C language defined in math.h.
log1p
static method log1pf : float ($x : float);
Calls the log1pf function of the C language defined in math.h.
log1pf
static method log2 : double ($x : double);
Calls the log2 function of the C language defined in math.h.
log2
static method log2f : float ($x : float);
Calls the log2f function of the C language defined in math.h.
log2f
static method logb : double ($x : double);
Calls the logb function of the C language defined in math.h.
logb
static method logbf : float ($x : float);
Calls the logbf function of the C language defined in math.h.
logbf
static method logf : float ($x : float);
Calls the logf function of the C language defined in math.h.
logf
static method lround : long ($x : double);
Calls the llround function of the C language defined in math.h.
llround
static method lroundf : long ($x : float);
Calls the llroundf function of the C language defined in math.h.
llroundf
static method modf : double ($x : double, $intpart : double*);
Calls the modf function of the C language defined in math.h.
modf
static method modff : float ($x : float, $intpart : float*);
Calls the modff function of the C language defined in math.h.
modff
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.
nan
Exceptions:
The $string must be defined. Otherwise an exception is thrown.
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.
static method nanf : float ($string : string);
Calls the nanf function of the C language defined in math.h.
nanf
static method nearbyint : double ($x : double);
Calls the nearbyint function of the C language defined in math.h.
nearbyint
static method nearbyintf : float ($x : float);
Calls the nearbyintf function of the C language defined in math.h.
nearbyintf
static method nextafter : double ($x : double, $y : double);
Calls the nextafter function of the C language defined in math.h.
nextafter
static method nextafterf : float ($x : float, $y : float);
Calls the nextafterf function of the C language defined in math.h.
nextafterf
static method nexttoward : double ($x : double, $y : double);
Calls the nexttoward function of the C language defined in math.h.
nexttoward
static method nexttowardf : float ($x : float, $y : double);
Calls the nexttowardf function of the C language defined in math.h.
nexttowardf
static method PI : double ();
Returns pi. This value is 0x1.921fb54442d18p+1.
0x1.921fb54442d18p+1
static method pow : double ($x : double, $y : double);
Calls the pow function of the C language defined in math.h.
pow
static method powf : float ($x : float, $y : float);
Calls the powf function of the C language defined in math.h.
powf
static method remainder : double ($x : double, $y : double);
Calls the remainder function of the C language defined in math.h.
remainder
static method remainderf : float ($x : float, $y : float);
Calls the remainderf function of the C language defined in math.h.
remainderf
static method remquo : double ($x : double, $y : double, $quo : int*);
Calls the remquo function of the C language defined in math.h.
remquo
static method remquof : float ($x : float, $y : float, $quo : int*);
Calls the remquof function of the C language defined in math.h.
remquof
static method round : double ($x : double);
Calls the round function of the C language defined in math.h.
round
static method roundf : float ($x : float);
Calls the roundf function of the C language defined in math.h.
roundf
static method scalbln : double ($x : double, $exp : long);
Calls the scalbln function of the C language defined in math.h.
scalbln
static method scalblnf : float ($x : float, $exp : long);
Calls the scalblnf function of the C language defined in math.h.
scalblnf
static method scalbn : double ($x : double, $exp : int);
Calls the scalbn function of the C language defined in math.h.
scalbn
static method scalbnf : float ($x : float, $exp : int);
Calls the scalbnf function of the C language defined in math.h.
scalbnf
static method signbit : int ($x : double);
Calls the signbit function of the C language defined in math.h.
signbit
static method signbitf : int ($x : float);
Calls the signbitf function of the C language defined in math.h.
signbitf
static method sin : double ($x : double);
Calls the sin function of the C language defined in math.h.
sin
static method sinf : float ($x : float);
Calls the sinf function of the C language defined in math.h.
sinf
static method sinh : double ($x : double);
Calls the sinh function of the C language defined in math.h.
sinh
static method sinhf : float ($x : float);
Calls the sinhf function of the C language defined in math.h.
sinhf
static method sqrt : double ($x : double);
Calls the sqrt function of the C language defined in math.h.
sqrt
static method sqrtf : float ($x : float);
Calls the sqrtf function of the C language defined in math.h.
sqrtf
static method tan : double ($x : double);
Calls the tan function of the C language defined in math.h.
tan
static method tanf : float ($x : float);
Calls the tanf function of the C language defined in math.h.
tanf
static method tanh : double ($x : double);
Calls the tanh function of the C language defined in math.h.
tanh
static method tanhf : float ($x : float);
Calls the tanhf function of the C language defined in math.h.
tanhf
static method tgamma : double ($x : double);
Calls the tgamma function of the C language defined in math.h.
tgamma
static method tgammaf : float ($x : float);
Calls the tgammaf function of the C language defined in math.h.
tgammaf
static method trunc : double ($x : double);
Calls the trunc function of the C language defined in math.h.
trunc
static method truncf : float ($x : float);
Calls the truncf function of the C language defined in math.h.
truncf
Copyright (c) 2023 Yuki Kimoto
MIT License
To install SPVM::Math, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SPVM::Math
CPAN shell
perl -MCPAN -e shell install SPVM::Math
For more information on module installation, please visit the detailed CPAN module installation guide.