I haven't used the Boost libraries at all, been out of the C++ ecosystem for a while now.
Complex numbers are super useful for physics stuff and also for optimisation. I just implemented it as a practice exercise, would be really surprised if there isn't a library for complex numbers already existing in Clojure.
One really cool feature in Clojure is the symbolic representation of rational numbers:
(/ 1 3)
evaluates to 1/3
rather than 0.3333
. This allows more precise calculations, as rounding only needs to be done at the end.
Posted Using LeoFinance Beta
Oh wow. If you write 0.20, it will be a repeated decimal in Clojure, won't it? So instead you could handle 0.2 by writing (/ 1 5).
Yes exactly.
0.2
would be of typedouble
and1/5
is called "ratio" type in Clojure.Posted Using LeoFinance Beta