@@ -254,13 +254,15 @@ JANET_CORE_FN(janet_srand,
254
254
return janet_wrap_nil ();
255
255
}
256
256
257
- #define JANET_DEFINE_MATHOP ( name , fop , doc )\
258
- JANET_CORE_FN(janet_##name , "(math/" #name " x)", doc) {\
257
+ #define JANET_DEFINE_NAMED_MATHOP ( c_name , janet_name , fop , doc )\
258
+ JANET_CORE_FN(janet_##c_name , "(math/" #janet_name " x)", doc) {\
259
259
janet_fixarity(argc, 1); \
260
260
double x = janet_getnumber(argv, 0); \
261
261
return janet_wrap_number(fop(x)); \
262
262
}
263
263
264
+ #define JANET_DEFINE_MATHOP (name , fop , doc ) JANET_DEFINE_NAMED_MATHOP(name, name, fop, doc)
265
+
264
266
JANET_DEFINE_MATHOP (acos , acos , "Returns the arccosine of x." )
265
267
JANET_DEFINE_MATHOP (asin , asin , "Returns the arcsin of x." )
266
268
JANET_DEFINE_MATHOP (atan , atan , "Returns the arctangent of x." )
@@ -269,7 +271,7 @@ JANET_DEFINE_MATHOP(cosh, cosh, "Returns the hyperbolic cosine of x.")
269
271
JANET_DEFINE_MATHOP (acosh , acosh , "Returns the hyperbolic arccosine of x." )
270
272
JANET_DEFINE_MATHOP (sin , sin , "Returns the sine of x." )
271
273
JANET_DEFINE_MATHOP (sinh , sinh , "Returns the hyperbolic sine of x." )
272
- JANET_DEFINE_MATHOP (asinh , asinh , "Returns the hypberbolic arcsine of x." )
274
+ JANET_DEFINE_MATHOP (asinh , asinh , "Returns the hyperbolic arcsine of x." )
273
275
JANET_DEFINE_MATHOP (tan , tan , "Returns the tangent of x." )
274
276
JANET_DEFINE_MATHOP (tanh , tanh , "Returns the hyperbolic tangent of x." )
275
277
JANET_DEFINE_MATHOP (atanh , atanh , "Returns the hyperbolic arctangent of x." )
@@ -287,7 +289,7 @@ JANET_DEFINE_MATHOP(floor, floor, "Returns the largest integer value number that
287
289
JANET_DEFINE_MATHOP (trunc , trunc , "Returns the integer between x and 0 nearest to x." )
288
290
JANET_DEFINE_MATHOP (round , round , "Returns the integer nearest to x." )
289
291
JANET_DEFINE_MATHOP (gamma , tgamma , "Returns gamma(x)." )
290
- JANET_DEFINE_MATHOP (lgamma , lgamma , "Returns log-gamma(x)." )
292
+ JANET_DEFINE_NAMED_MATHOP (lgamma , "log-gamma" , lgamma , "Returns log-gamma(x)." )
291
293
JANET_DEFINE_MATHOP (log1p , log1p , "Returns (log base e of x) + 1 more accurately than (+ (math/log x) 1)" )
292
294
JANET_DEFINE_MATHOP (erf , erf , "Returns the error function of x." )
293
295
JANET_DEFINE_MATHOP (erfc , erfc , "Returns the complementary error function of x." )
@@ -303,7 +305,7 @@ JANET_CORE_FN(janet_##name, signature, doc) {\
303
305
JANET_DEFINE_MATH2OP (atan2 , atan2 , "(math/atan2 y x)" , "Returns the arctangent of y/x. Works even when x is 0." )
304
306
JANET_DEFINE_MATH2OP (pow , pow , "(math/pow a x)" , "Returns a to the power of x." )
305
307
JANET_DEFINE_MATH2OP (hypot , hypot , "(math/hypot a b)" , "Returns c from the equation c^2 = a^2 + b^2." )
306
- JANET_DEFINE_MATH2OP (nextafter , nextafter , "(math/next x y)" , "Returns the next representable floating point vaue after x in the direction of y." )
308
+ JANET_DEFINE_MATH2OP (nextafter , nextafter , "(math/next x y)" , "Returns the next representable floating point value after x in the direction of y." )
307
309
308
310
JANET_CORE_FN (janet_not , "(not x)" , "Returns the boolean inverse of x." ) {
309
311
janet_fixarity (argc , 1 );
0 commit comments