aboutsummaryrefslogtreecommitdiffstats
path: root/complex.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-10-17 12:00:39 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-10-17 12:02:34 +0900
commit7cf37a57221c085aaf29e260060ea0e709af1e93 (patch)
tree77d4139259a1b61ec7364cfb9c7360835b175dca /complex.c
parente4191ac1ec7940b37bfeaf09c000cf46d2db5200 (diff)
downloadruby-7cf37a57221c085aaf29e260060ea0e709af1e93.tar.gz
[DOC] Add the polar form in String#to_c
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c6
1 files changed, 6 insertions, 0 deletions
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)
* '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