Ruby 2.7.7p221 (2022-11-24 revision 168ec2b1e5ad0e4688e963d9de019557c78feed9)
Macros | Functions | Variables
math.c File Reference
#include "internal.h"
#include <float.h>
#include <math.h>
#include <errno.h>

Go to the source code of this file.

Macros

#define RB_BIGNUM_TYPE_P(x)   RB_TYPE_P((x), T_BIGNUM)
 
#define Get_Double(x)   rb_num_to_dbl(x)
 
#define domain_error(msg)    rb_raise(rb_eMathDomainError, "Numerical argument is out of domain - " #msg)
 
#define M_LN2   0.693147180559945309417232121458176568
 
#define M_LN10   2.30258509299404568401799145468436421
 
#define f_boolcast(x)   ((x) ? Qtrue : Qfalse)
 
#define exp1(n)
 
#define exp2(n)
 

Functions

double cosh (double x)
 
double sinh (double x)
 
double tanh (double x)
 
 FUNC_MINIMIZED (static VALUE math_log(int, const VALUE *, VALUE))
 
VALUE rb_math_log (int argc, const VALUE *argv)
 
double log2 (double x)
 
 exp2 (atan2)
 
void Init_Math (void)
 

Variables

VALUE rb_mMath
 
VALUE rb_eMathDomainError
 

Macro Definition Documentation

◆ domain_error

#define domain_error (   msg)     rb_raise(rb_eMathDomainError, "Numerical argument is out of domain - " #msg)

Definition at line 32 of file math.c.

◆ exp1

#define exp1 (   n)
Value:
VALUE \
rb_math_##n(VALUE x)\
{\
return math_##n(0, x);\
}
const char size_t n
unsigned long VALUE
Definition: ruby.h:102

Definition at line 923 of file math.c.

◆ exp2

#define exp2 (   n)
Value:
VALUE \
rb_math_##n(VALUE x, VALUE y)\
{\
return math_##n(0, x, y);\
}

Definition at line 930 of file math.c.

◆ f_boolcast

#define f_boolcast (   x)    ((x) ? Qtrue : Qfalse)

Definition at line 617 of file math.c.

◆ Get_Double

#define Get_Double (   x)    rb_num_to_dbl(x)

Definition at line 30 of file math.c.

◆ M_LN10

#define M_LN10   2.30258509299404568401799145468436421

Definition at line 425 of file math.c.

◆ M_LN2

#define M_LN2   0.693147180559945309417232121458176568

Definition at line 422 of file math.c.

◆ RB_BIGNUM_TYPE_P

#define RB_BIGNUM_TYPE_P (   x)    RB_TYPE_P((x), T_BIGNUM)

Definition at line 25 of file math.c.

Function Documentation

◆ cosh()

double cosh ( double  x)

Definition at line 228 of file math.c.

References exp().

Referenced by tanh().

◆ exp2()

exp2 ( atan2  )

◆ FUNC_MINIMIZED()

FUNC_MINIMIZED ( static VALUE   math_logint, const VALUE *, VALUE)

◆ Init_Math()

void Init_Math ( void  )

Definition at line 1030 of file math.c.

References InitVM.

◆ log2()

double log2 ( double  x)

Definition at line 506 of file math.c.

References log10().

◆ rb_math_log()

VALUE rb_math_log ( int  argc,
const VALUE argv 
)

Definition at line 459 of file math.c.

References argc, argv, and rb_scan_args.

Referenced by imp1().

◆ sinh()

double sinh ( double  x)

Definition at line 256 of file math.c.

References exp().

Referenced by tanh().

◆ tanh()

double tanh ( double  x)

Definition at line 284 of file math.c.

References cosh(), exp(), isinf, and sinh().