-
Notifications
You must be signed in to change notification settings - Fork 26
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
Rational denominator overflow in nm^3 #22
Comments
Maybe make nm use |
That would just be delaying the problem, no? Conceivably someone would want |
Arguably people who work with more than 3 space dimensions don't tend to use meters, but fair enough. Maybe have the base units use a custom order-of-magnitude type? Then you could go as high as |
Keeping track of the order of magnitude separately would work. Do you envision |
(Meter^3, -27). I'd just go for Float64, but that can't represent 10^n exactly which is something I do want if people have custom types for which it matters. For builtin types in arithmetic I'd just default to Float64. |
Fair enough, especially since SI prefixes go up to 10^24. (Scaling is a very common problem in scientific calculations; many practical computations explicitly work in custom, transformed units where the quantities are close to 1.0.) |
Hmm yeah this makes me wonder if we should support something more general here. |
I guess people can always define their own custom non-si unit with whatever scaling they want, but you do lose a bunch of nice things. |
Would be nice to figure out something that would general enough to work with fractional powers also. |
Yeah, I've been meaning to put some more thought into this package. Added to the ever-growing todo list. |
For fractional powers, I will see if I can come up with a more acceptable version of JuliaLang/julia#7172. If one is thinking about generalizing this package: I'm mulling over conversions like JuliaImages/Images.jl#101. That presumably would be best done with an SIUnits-like approach with |
I've also wondered whether time stuff shouldn't be integrated with some kind of units – UT time is odd because it's an angular measurement, not an actual time measurement, but that's fundamentally what it is. At which point one starts wondering if unit support doesn't belong in base. cc: @quinnj, @JeffBezanson. |
Also, I wonder if this particular issue couldn't be addressed with some kind of fixed-point type. Something like |
As a possible alternative to Base, I was thinking in terms of a All this of course puts pressure on some of our current type-inference challenges, but perhaps this kind of development will help clarify what is needed. |
Sorry for not commenting earlier. Yeah, I think generally the idea is good to have solid units backing everything, though I worry about getting all the abstractions playing nicely with one another so it's actually feasible to use in other packages pleasantly. Seems tricky to work out corner cases or weird domain issues (I'm thinking about some of the hassles we went through with the StepRange for Dates/Periods business), that end up throwing a wrench in a nicely laid abstraction plan. |
The text was updated successfully, but these errors were encountered: