diff options
author | Koki Fushimi <paalon1936@gmail.com> | 2018-06-02 00:20:28 +0900 |
---|---|---|
committer | Varriount <Varriount@users.noreply.github.com> | 2018-06-01 11:20:28 -0400 |
commit | 3acedd4cd95e75f04714590f5dbd5876e3a936e8 (patch) | |
tree | 9034b6b049bdc329f9f1e6022c21a665d53842c9 /lib | |
parent | 3027ca292c3fbdb5387d0b8834c7e3dc960df75d (diff) | |
download | Nim-3acedd4cd95e75f04714590f5dbd5876e3a936e8.tar.gz |
Add imaginary unit. (#7922)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/complex.nim | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/pure/complex.nim b/lib/pure/complex.nim index 98cab1a5a..ba5c571ce 100644 --- a/lib/pure/complex.nim +++ b/lib/pure/complex.nim @@ -25,6 +25,10 @@ type Complex* = tuple[re, im: float] ## a complex number, consisting of a real and an imaginary part +const + im*: Complex = (re: 0.0, im: 1.0) + ## The imaginary unit. √-1. + proc toComplex*(x: SomeInteger): Complex = ## Convert some integer ``x`` to a complex number. result.re = x |