Can't divide by small durations

Open
#172 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
clojure
Domain
backend

Research direction

Start at tick.alpha.interval/divide in interval.cljc around lines 900-901, using the three duration expressions from the issue to reproduce the ArithmeticException. Trace the division path and verify that all three examples complete without a divide-by-zero error.

Written by the indexing model from the issue text.

Description

interval-calculus

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
Dominant language
Clojure
Stars
646
Forks
61
Avg merge
17h 42m
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from juxt/tick

All issues in juxt/tick

Similar issues

More Clojure issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.