Imaginary literals are described by the following lexical definitions:
虚数的字面值可以用下面的词法定义描述:
imagnumber |
::= | (floatnumber | intpart) ("j" | "J") |
An imaginary literal yields a complex number with a real part of
0.0. Complex numbers are represented as a pair of floating point
numbers and have the same restrictions on their range. To create a
complex number with a nonzero real part, add a floating point number
to it, e.g., (3+4j)
. Some examples of imaginary literals:
虚数是实部为零的复数, 复数表达成一对有着相同取值范围的浮点数对.为了创建一个有着非零实部的复数,可以对它增加一个浮点数,例如,(3+4j). 下面是一些例子:
3.14j 10.j 10j .001j 1e100j 3.14e-10j