Logo

Programming-Idioms

History of Idiom 77 > diff from v18 to v19

Edit summary for version 19 by Fierthraix:
New Rust implementation by user [Fierthraix]

Version 18

2016-12-04, 22:22:25

Version 19

2018-04-09, 15:19:40

Idiom #77 Complex number

Declare a complex x and initialize it with value (3i - 2). Then multiply it by i.

Illustration

Idiom #77 Complex number

Declare a complex x and initialize it with value (3i - 2). Then multiply it by i.

Illustration
Imports
extern crate num;
use num::Complex;
Code
let mut x = Complex::new(-2, 3);
x *= Complex::i();
Doc URL
https://docs.rs/num-complex/0.1.43/num_complex/struct.Complex.html
Demo URL
https://play.rust-lang.org/?gist=f868202c8c970aefa07e761c95221738&version=stable