tick
tick copied to clipboard
Can't divide by small durations
Hey, really nice work on tick.
Seems like these should work:
(t.i/divide (t/new-duration 1 :seconds) (t/new-duration 1 :millis))
(t.i/divide (t/new-duration 1 :seconds) (t/new-duration 1 :micros))
(t.i/divide (t/new-duration 1 :seconds) (t/new-duration 1 :nanos))
Error:
Unhandled java.lang.ArithmeticException
Divide by zero
Numbers.java: 190 clojure.lang.Numbers/divide
core.cljc: 915 tick.core$eval17885$fn__17886/invoke
protocols.cljc: 51 tick.protocols$eval15134$fn__15135$G__15125__15142/invoke
core.cljc: 921 tick.core$eval17889$fn__17890/invoke
protocols.cljc: 48 tick.protocols$eval15106$fn__15107$G__15097__15114/invoke
interval.cljc: 901 tick.alpha.interval$divide/invokeStatic
interval.cljc: 900 tick.alpha.interval$divide/invoke
Thanks. Dividing durations impl is done by getting the duration lengths in seconds.
It might be that is as intended, in which case a pre-check could be added.
This will get addressed when the interval calculus stuff gets looked at again - not sure when that will be.