-
Notifications
You must be signed in to change notification settings - Fork 24
Simple affine units implementation #168
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
Conversation
Coverage file not required
Shortened the explanations of AffineDimensions
Undid stray edit
Benchmark Results
Benchmark PlotsA plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. |
What kind of object does |
(Though I was thinking of deleting that, so users would need to be very explicit about getting an |
I'd actually prefer a string macro that produced units, so this looks like a very clever fix. As long 'ua"..."' and 'aff_uparse("...")' produces a consistent object (AffineUnits) and works on any units in the registry, this is probably good enough for most basic use cases. Are you able to convert a quantity back to affine units? I typically only use this worklow: {customer units}->{si units}->{numbers}->{algorithm}->{si units}->{customer units} |
There’s no conversion to affine units, only from affine to SI. Right now there’s not even a display in affine units, because you would never use a naked I feel the reverse from SI to affine + printing might be ok to do in user code, so I don't see a huge need to add it here. Also, why do you need the other units accessible in try
uparse(s)
catch
aff_uparse(s)
end I don’t know why DQ would need to do this internally. |
Ok I am pretty happy with this. From 744 to 217 lines compared to #159, and gets the main functionality without the difficulties of treating affine units as regular Note that I am labelling everything as "experimental" so there's the opportunity to roll things back or make changes if needed. |
@Deduction42
Here is a reduced version of #159 with only the basic functionality. Writing out
degC
will auto-convert to dimensions when you multiply it with a number:That's basically it. I think this gets the main feature of unit parsing but without needing to have a separate
AffineDimensions
object that requires a lot of patching throughout the library.