Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't divide by small durations #172

Open
kimo-k opened this issue Jun 27, 2022 · 1 comment
Open

Can't divide by small durations #172

kimo-k opened this issue Jun 27, 2022 · 1 comment

Comments

@kimo-k
Copy link

kimo-k commented Jun 27, 2022

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
@henryw374
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants