[前][次][番号順一覧][スレッド一覧]

ruby-changes:56917

From: Nobuyoshi <ko1@a...>
Date: Sat, 10 Aug 2019 23:24:27 +0900 (JST)
Subject: [ruby-changes:56917] Nobuyoshi Nakada: 52bd4716b4 (master): rb_numeric_quo: support Complex

https://git.ruby-lang.org/ruby.git/commit/?id=52bd4716b4

From 52bd4716b482337bd8f9f8389c5ab9d168fb11f8 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 10 Aug 2019 23:19:24 +0900
Subject: rb_numeric_quo: support Complex


diff --git a/rational.c b/rational.c
index d032cbd..0dfc8ab 100644
--- a/rational.c
+++ b/rational.c
@@ -2014,6 +2014,10 @@ numeric_denominator(VALUE self) https://github.com/ruby/ruby/blob/trunk/rational.c#L2014
 VALUE
 rb_numeric_quo(VALUE x, VALUE y)
 {
+    if (RB_TYPE_P(x, T_COMPLEX)) {
+        return rb_complex_div(x, y);
+    }
+
     if (RB_FLOAT_TYPE_P(y)) {
         return rb_funcallv(x, idFdiv, 1, &y);
     }
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]