Math constants and functions
GreyCat core offers a range of math constants and functions which should be self explanatory and will, therefore only be listed here.
Constants
Constants are accessible via the type MathConstants using the - attribute operator, e.g. MathConstants::e.
The type offers the following constants:
e: float = 2.7182818284590452354_flog_2e: float = 1.4426950408889634074_flog_10e: float = 0.43429448190325182765_fln2: float = 0.69314718055994530942_fln10: float = 2.30258509299404568402_fpi: float = 3.14159265358979323846_fpi_2: float = 1.57079632679489661923_fpi_4: float = 0.78539816339744830962_fm1_pi: float = 0.31830988618379067154_fm2_pi: float = 0.63661977236758134308_fm2_sqrt_pi: float = 1.12837916709551257390_fsqrt2: float = 1.41421356237309504880_fsqrt1_2: float = 0.70710678118654752440_f
Functions
The following math functions are directly accessible in any gcl file without importing another module.
cos(x: float): floatsin(x: float): floattan(x: float): floatsqrt(x: float): floatfloor(x: float): floatceil(x: float): floatcosh(x: float): floatsinh(x: float): floattanh(x: float): floatacos(x: float): floatasin(x: float): floatatan(x: float): floatlog(x: float): floatlog2(x: float): floatlog10(x: float): floatpow(x: float, y: float): floattrunc(x: float): floatround(x: float): floatabs(x: int): intmin(x: int, y: int): intmax(x: int, y: int): intabsf(x: float): floatminf(x: float, y: float): floatmaxf(x: float, y: float): floatisNaN(v: float): bool/// return true if v paramater is a NaN, false otherwise.roundp(x: float, p: int): float/// round a float value to the closest p floating decimal