ruby-changes:74031
From: Nobuyoshi <ko1@a...>
Date: Mon, 17 Oct 2022 12:02:57 +0900 (JST)
Subject: [ruby-changes:74031] 7cf37a5722 (master): [DOC] Add the polar form in String#to_c
https://git.ruby-lang.org/ruby.git/commit/?id=7cf37a5722 From 7cf37a57221c085aaf29e260060ea0e709af1e93 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Mon, 17 Oct 2022 12:00:39 +0900 Subject: [DOC] Add the polar form in String#to_c --- complex.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/complex.c b/complex.c index 07e5914d54..18d61b206f 100644 --- a/complex.c +++ b/complex.c @@ -2026,6 +2026,12 @@ string_to_c_strict(VALUE self, int raise) https://github.com/ruby/ruby/blob/trunk/complex.c#L2026 * '1/2+3/4i'.to_c #=> ((1/2)+(3/4)*i) * 'ruby'.to_c #=> (0+0i) * + * Polar form: + * include Math + * "1.0@0".to_c #=> (1+0.0i) + * "1.0@#{PI/2}".to_c #=> (0.0+1i) + * "1.0@#{PI}".to_c #=> (-1+0.0i) + * * See Kernel.Complex. */ static VALUE -- cgit v1.2.3 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/