Complex numbers

Sinds 3.3

If a number is followed by the i or I character (with no space), then it is assumed to be a complex number constant.

In that case, if no component provides support for complex numbers, the gb.complex component is automatically loaded, and adds a new Complex class to the interpreter.

To write the real part of the complex number constant, you have to add a floating-point number with the addition operator.

The i or I letter alone is still a valid identifier. So write 1i to use i.

Examples

1i
1
+2i
-3.14i
0.5
+0.1i
0i

See also