Embedding of real numbers in complex numbers

Factor handbook » The language » Numbers » Complex numbers

Factor handbook » The language » Numbers » Complex numbers

Prev: | rect> ( x y -- z ) |

Constructing a complex number with an imaginary component equal to an integer zero simply returns the real number corresponding to the real component:

Constructing a complex number with an imaginary component equal to floating point zero will still output a new complex number, however:

Unlike math, where all real numbers are also complex numbers, Factor only considers a number to be a complex number if its imaginary part is non-zero. However, complex number operations are fully supported for real numbers; they are treated as having an imaginary part of zero.

C{ 1 2 } C{ 3 -2 } + .

4

4

Constructing a complex number with an imaginary component equal to floating point zero will still output a new complex number, however:

C{ 0.0 2.0 } C{ 0.0 1.0 } * .

C{ -2.0 0.0 }

C{ -2.0 0.0 }

Unlike math, where all real numbers are also complex numbers, Factor only considers a number to be a complex number if its imaginary part is non-zero. However, complex number operations are fully supported for real numbers; they are treated as having an imaginary part of zero.

This documentation was generated offline from a
`load-all`

image. If you want, you can also
browse the documentation from within the UI developer tools. See
the Factor website
for more information.

Factor 0.100 x86.64 (2270, heads/master-9a858f779b, Jun 12 2024 16:13:38)