官术网_书友最值得收藏!

Getting real and imaginary parts

The two methods—re and im—return real and imaginary parts of the complex number, as follows:

my $z = 4+5i;

say $z.re;
# 4
say $z.im; # 5

The imaginary part is returned without the variable i.

The reals method returns a list containing both values, as shown here:

my $z = 4+5i;
say $z.reals; # (4 5)
主站蜘蛛池模板: 八宿县| 沙坪坝区| 澄江县| 渭源县| 济阳县| 噶尔县| 伊吾县| 宣化县| 陈巴尔虎旗| 肃南| 崇信县| 清涧县| 上饶市| 明光市| 河曲县| 吴忠市| 蓬溪县| 兰西县| 沙河市| 贵港市| 宁乡县| 柳江县| 高碑店市| 昭平县| 镇巴县| 诸暨市| 元朗区| 河东区| 新丰县| 克东县| 大关县| 白银市| 铅山县| 威海市| 黄冈市| 资中县| 封开县| 重庆市| 轮台县| 土默特右旗| 贡觉县|