Rationals vs Decimals in Clojure
- Use rationals if accuracy is your main concern. For example, operations on decimals are not associative.
|
|
From the above example, one can infer that decimals are subjected to Floating Point corruption. You can find more examples here.
- Rationals are slower in terms of operations on them when compared to decimals. There is an overhead involved when doing operations on rationals.