diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-17 02:41:26 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-17 02:41:26 +0000 |
commit | 63bd0417eed9fd04f990d011e1050325db8cd87a (patch) | |
tree | 11a0014adc384f70d4e947268b91a581fa42fe92 /complex.c | |
parent | cdca211b19929082ed2e0b537b7038595f707e55 (diff) | |
download | bundler-63bd0417eed9fd04f990d011e1050325db8cd87a.tar.gz |
share Float 0
* complex.c (RFLOAT_0): share the 0.0 object on non-flonum
platforms.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'complex.c')
-rw-r--r-- | complex.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -20,7 +20,11 @@ #define ZERO INT2FIX(0) #define ONE INT2FIX(1) #define TWO INT2FIX(2) +#if USE_FLONUM #define RFLOAT_0 DBL2NUM(0) +#else +static VALUE RFLOAT_0; +#endif #if defined(HAVE_SIGNBIT) && defined(__GNUC__) && defined(__sun) && \ !defined(signbit) extern int signbit(double); @@ -2271,6 +2275,10 @@ Init_Complex(void) rb_define_const(rb_cComplex, "I", f_complex_new_bang2(rb_cComplex, ZERO, ONE)); +#if !USE_FLONUM + rb_gc_register_mark_object(RFLOAT_0 = DBL2NUM(0.0)); +#endif + rb_provide("complex.so"); /* for backward compatibility */ } |