Class to represent complex numbers in Scala. A complex number is a number that can be expressed in the form a + b*i
(as in the image below), where a
and b
are real numbers, and i
is the solution of the equation x^2 = -1
.
This class was implemented using a generic type, which was implemented here, which supports some basic algebraic operations and is defined for types Int, Float, Double, Long. The tests made are of simple character, and for this the Scala Test was used. In total 38 tests were performed.
###Project Structure
src
|
|
\---main
| \---scala
| \---complexNumbers
| Complex.scala
| Num.scala
|
\---test
| \---scala
| \---complexNumbers
| ComplexNumbersSuite.scala
|
|
+---.gitignore
build.sbt
LICENSE
README.md
To perform the tests it is necessary to be in the root directory(where the build.sbt file is), then use the sbt test
command. The tests used FunSuite and assert's.
The IDE used was Intellij Idea.
The LICENSE used is Apache-2.0.