You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, thanks for bringing this up. I haven't tested this properly in cljs apparently.
I want broch's behaviour in cljs to be equal to that in clj. In clj, I've used ratio's to maintain precision, but this isn't available in cljs (yet). So I will have to solve this differently in cljs, maybe using mathjs as you suggest. However, broch currently has no dependencies, and I would like to keep it that way.
So I'll have a think about how best to solve this. Preferably without introducing dependencies, but I might have to cede that in this case.
I'll keep you posted on this. Again, thanks for bringing it up 😄
Solved in latest release.
Ended up implementing the necessary exact operations on my own ratio type in cljs.
Let me know if there's any further issues.
Hi, thanks for this useful library. However, there is one common problem with JS, precision.
CLJ environment:
(b/+ (b/millimeters 1) (b/meters 1))
=> #broch/quantity[1001 "mm"](b/* (b/+ (b/millimeters 1) (-> (b/meters 1) (b/millimeters))) (b/meters 1.5))
=> #broch/quantity[1501500 "mm²"]CLJS environment
(b/+ (b/millimeters 1) (b/meters 1))
=> #broch/quantity[1000.9999999999999 "mm"](b/* (b/+ (b/millimeters 1) (-> (b/meters 1) (b/millimeters))) (b/meters 1.5))
=> #broch/quantity[1501499.9999999998 "mm²"]e.g. https://mathjs.org/ doesn't have this problem.
I don't know what must be done to make this more consistent with JVM results. Maybe somebody thought about this already?
The text was updated successfully, but these errors were encountered: