Is there a way to set the rounding mode in the format function of Clojure? What I would like to achieve is, that the number is not rounded, but "floored" (e.g. 10.126
should become 10.12
and not 10.13
).
In other words, I'm looking for something similar as this question / answer, that is, the Clojure equivalent of NumberFormat.setRoundingMode.
Any "pure", built-in Clojure solution is fine, though it does not necessarily have to be with format
.
Out of scope is the following, (although I'm aware they are also workable solutions):
- Using any Java classes (as I said, I'm looking for for a pure and built-in Clojure-solution)
- Converting the float to string, and back to float with the current number of decimals (I'm doing this currently, and was wondering if there is a better way).
N.B.: In case this is not possible at all with a built-in Clojure function (which I'm beginning to suspect), then a link to some documentation confirming this is also a valid answer for me.