1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-27 00:40:26 +00:00

Merge pull request #960 from uvtc/patch-5

math.c
This commit is contained in:
Calvin Rose 2022-04-17 20:03:25 -05:00 committed by GitHub
commit 9986aab326
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -231,7 +231,7 @@ static Janet janet_rng_next(void *p, Janet key) {
/* Get a random number */ /* Get a random number */
JANET_CORE_FN(janet_rand, JANET_CORE_FN(janet_rand,
"(math/random)", "(math/random)",
"Returns a uniformly distributed random number between 0 and 1") { "Returns a uniformly distributed random number between 0 and 1.") {
(void) argv; (void) argv;
janet_fixarity(argc, 0); janet_fixarity(argc, 0);
return janet_wrap_number(janet_rng_double(&janet_vm.rng)); return janet_wrap_number(janet_rng_double(&janet_vm.rng));
@ -240,7 +240,7 @@ JANET_CORE_FN(janet_rand,
/* Seed the random number generator */ /* Seed the random number generator */
JANET_CORE_FN(janet_srand, JANET_CORE_FN(janet_srand,
"(math/seedrandom seed)", "(math/seedrandom seed)",
"Set the seed for the random number generator. seed should be " "Set the seed for the random number generator. `seed` should be "
"an integer or a buffer." "an integer or a buffer."
) { ) {
janet_fixarity(argc, 1); janet_fixarity(argc, 1);
@ -261,7 +261,7 @@ JANET_CORE_FN(janet_##name, "(math/" #name " x)", doc) {\
return janet_wrap_number(fop(x)); \ return janet_wrap_number(fop(x)); \
} }
JANET_DEFINE_MATHOP(acos, acos, "Returns the arccosize of x.") JANET_DEFINE_MATHOP(acos, acos, "Returns the arccosine of x.")
JANET_DEFINE_MATHOP(asin, asin, "Returns the arcsin of x.") JANET_DEFINE_MATHOP(asin, asin, "Returns the arcsin of x.")
JANET_DEFINE_MATHOP(atan, atan, "Returns the arctangent of x.") JANET_DEFINE_MATHOP(atan, atan, "Returns the arctangent of x.")
JANET_DEFINE_MATHOP(cos, cos, "Returns the cosine of x.") JANET_DEFINE_MATHOP(cos, cos, "Returns the cosine of x.")