diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-28 14:11:08 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-28 14:11:08 +0000 |
commit | 2b72e549a755dec2fbbf78199e41d4148683d025 (patch) | |
tree | 25aa67933c32d251d4a631278881fb3adde4eca6 /complex.c | |
parent | d563f1680cba03335eb38bd9e7bce8b82f03e12d (diff) |
* complex.c: continues to support canonicalization *unofficially*
for an odd library mathn for the time being (only 1.9.x).
since grand mathn is must be very very special library for us.
* rational.c: ditto.
* ext/mathn/*/*: follow the above changes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'complex.c')
-rw-r--r-- | complex.c | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -320,7 +320,19 @@ f_complex_new_bang2(VALUE klass, VALUE x, VALUE y) return nucomp_s_new_internal(klass, x, y); } -#define f_unify_p(klass) rb_const_defined(klass, id_Unify) +#if RUBY_VERSION_CODE < 200 +#define CANON +#endif + +#ifdef CANON +static int canonicalization = 0; + +void +nucomp_canonicalize(int f) +{ + canonicalization = f; +} +#endif inline static void nucomp_real_check(VALUE num) @@ -343,10 +355,10 @@ nucomp_s_canonicalize_internal(VALUE klass, VALUE real, VALUE imag) #ifdef CANON #define CL_CANON #ifdef CL_CANON - if (f_zero_p(imag) && k_exact_p(imag) && f_unify_p(klass)) + if (f_zero_p(imag) && k_exact_p(imag) && canonicalization) return real; #else - if (f_zero_p(imag) && f_unify_p(klass)) + if (f_zero_p(imag) && canonicalization) return real; #endif #endif |