mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/bigdecimal] Support Ruby < 2.6
https://github.com/ruby/bigdecimal/commit/61ec452599
This commit is contained in:
parent
03a33603c6
commit
40b82afe6a
Notes:
git
2020-07-06 08:56:27 +09:00
2 changed files with 27 additions and 0 deletions
|
@ -128,6 +128,30 @@ rb_rational_den(VALUE rat)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_RB_COMPLEX_REAL
|
||||
static inline VALUE
|
||||
rb_complex_real(VALUE cmp)
|
||||
{
|
||||
#ifdef HAVE_TYPE_STRUCT_RCOMPLEX
|
||||
return RCOMPLEX(cmp)->real;
|
||||
#else
|
||||
return rb_funcall(cmp, rb_intern("real"), 0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_RB_COMPLEX_IMAG
|
||||
static inline VALUE
|
||||
rb_complex_imag(VALUE cmp)
|
||||
{
|
||||
#ifdef HAVE_TYPE_STRUCT_RCOMPLEX
|
||||
return RCOMPLEX(cmp)->imag;
|
||||
#else
|
||||
return rb_funcall(cmp, rb_intern("imag"), 0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#define BIGDECIMAL_POSITIVE_P(bd) ((bd)->sign > 0)
|
||||
#define BIGDECIMAL_NEGATIVE_P(bd) ((bd)->sign < 0)
|
||||
|
||||
|
|
|
@ -36,6 +36,9 @@ have_func("isfinite", "math.h")
|
|||
have_type("struct RRational", "ruby.h")
|
||||
have_func("rb_rational_num", "ruby.h")
|
||||
have_func("rb_rational_den", "ruby.h")
|
||||
have_type("struct RComplex", "ruby.h")
|
||||
have_func("rb_complex_real", "ruby.h")
|
||||
have_func("rb_complex_imag", "ruby.h")
|
||||
have_func("rb_array_const_ptr", "ruby.h")
|
||||
have_func("rb_sym2str", "ruby.h")
|
||||
have_func("rb_opts_exception_p", "ruby.h")
|
||||
|
|
Loading…
Reference in a new issue