Exercise 1.6.9

Complex Numbers

Common Lisp has built-in support for Complex Numbers. You can perform arithmetic on them just like any other number type.

In the REPL

(sqrt -1)

(+ #C(0.0 1.0) #C(0.0 1.0))

(* #C(0.0 1.0) #C(0.0 1.0))

What You Should See

* (sqrt -1)
#C(0.0 1.0)

* (+ #C(0.0 1.0) #C(0.0 1.0))
#C(0.0 2.0)

* (* #C(0.0 1.0) #C(0.0 1.0))
#C(-1.0 0.0)

results matching ""

    No results matching ""