Ruby  3.1.0dev(2021-09-10revisionb76ad15ed0da636161de0243c547ee1e6fc95681)
Macros | Functions | Variables
math.c File Reference

(b76ad15ed0da636161de0243c547ee1e6fc95681)

#include "ruby/internal/config.h"
#include <errno.h>
#include <float.h>
#include <math.h>
#include "internal.h"
#include "internal/bignum.h"
#include "internal/complex.h"
#include "internal/object.h"
#include "internal/vm.h"
Include dependency graph for math.c:

Go to the source code of this file.

Macros

#define _USE_MATH_DEFINES   1
 
#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 domain_check_min(val, min, msg)   ((val) < (min) ? domain_error(msg) : (void)0)
 
#define domain_check_range(val, min, max, msg)   ((val) < (min) || (max) < (val) ? domain_error(msg) : (void)0)
 
#define M_LN2   0.693147180559945309417232121458176568
 
#define M_LN10   2.30258509299404568401799145468436421
 
#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

◆ _USE_MATH_DEFINES

#define _USE_MATH_DEFINES   1

Definition at line 15 of file math.c.

◆ domain_check_min

#define domain_check_min (   val,
  min,
  msg 
)    ((val) < (min) ? domain_error(msg) : (void)0)

Definition at line 38 of file math.c.

◆ domain_check_range

#define domain_check_range (   val,
  min,
  max,
  msg 
)    ((val) < (min) || (max) < (val) ? domain_error(msg) : (void)0)

Definition at line 40 of file math.c.

◆ domain_error

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

Definition at line 36 of file math.c.

◆ exp1

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

Definition at line 922 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 929 of file math.c.

◆ Get_Double

#define Get_Double (   x)    rb_num_to_dbl(x)

Definition at line 34 of file math.c.

◆ M_LN10

#define M_LN10   2.30258509299404568401799145468436421

Definition at line 429 of file math.c.

◆ M_LN2

#define M_LN2   0.693147180559945309417232121458176568

Definition at line 426 of file math.c.

◆ RB_BIGNUM_TYPE_P

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

Definition at line 29 of file math.c.

Function Documentation

◆ cosh()

double cosh ( double  x)

Definition at line 234 of file math.c.

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 1029 of file math.c.

References InitVM.

◆ log2()

double log2 ( double  x)

Definition at line 509 of file math.c.

◆ rb_math_log()

VALUE rb_math_log ( int  argc,
const VALUE argv 
)

Definition at line 463 of file math.c.

References argc, argv, and rb_scan_args().

Referenced by imp1().

◆ sinh()

double sinh ( double  x)

Definition at line 262 of file math.c.

Referenced by tanh().

◆ tanh()

double tanh ( double  x)

Definition at line 290 of file math.c.

References cosh(), and sinh().

Variable Documentation

◆ rb_eMathDomainError

VALUE rb_eMathDomainError

Definition at line 32 of file math.c.

Referenced by exp2().

◆ rb_mMath

VALUE rb_mMath

Definition at line 31 of file math.c.

Referenced by exp2().

y
size_t y
Definition: memory.h:207
VALUE
unsigned long VALUE
Definition: value.h:38