Comments (7)
I went back and forth on "am" being attometer and arcminute. The astronomy field in this case won out.
as far as the capitalization, some strings only use capital case for units so it needs to support that, and if it fails on the first pass it just lowers the case and tries again. Where the prefix is unambiguous both the lower case and upper case were allowed.
A couple of those I will look at fixing though.
Thanks
from units.
I went back and forth on "am" being attometer and arcminute. The astronomy field in this case won out.
Ahh, the curse of compromises... apparently no software project can escape from that. ;)
From my point view
- SI is to be preferred, symbol for
minute
ismin
. - If you indeed add string formatting for attometer as
am
(to be consistent with, say,fm
) you would not be able to round-trip becausestring("attometer")
-> unit ->string("am")
-> unit would yield arcmin.
from units.
What I am playing with a domain mapping, which could be set by default or controlled through the match_flags argument.
This would trigger different string conversions depending on the specific domain and enable standard SI to be the default.
current planned domains include
cooking
astronomy
nuclear
surveying
ucum
strict_si
these are ones where there are some potential unit strings that mean different things in the different domains.
My inclination is default to more relaxed approach so where the capitalization on the prefix is unambiguous it should be allowed but if the strict_si domain is enabled they would not be.
from units.
That sounds like a very promising approach! Is the plan that multiple domains could be enabled at the same time?
from units.
Still playing with it as to how it would work. Right now I am leaning towards making strict_si
a flag that would disable the flexible capitalization rules for prefixes and a few other things. So that would work with all the others without issue.
The other domains would be mutually exclusive so you couldn't use more than one domain. The mechanism I am using does allow a few exceptions to that so a few particular combination might be allowed, still working out the details.
from units.
@SimonHeybrock #173 tries to address this and add the domain logic.
from units.
This appears to work now as expected. Thanks a lot!
from units.
Related Issues (20)
- Conan package HOT 12
- Convert to inverse unit incorrect HOT 1
- CleanUnitString breaks on 0.2 and 0.3 HOT 1
- Strange choice of units in to_string HOT 6
- Your units conversion service seems to be down... HOT 11
- "kg m" is parsed as "kg" HOT 1
- Surprising parse results with `.` and `-` HOT 4
- Question about to_string() function HOT 8
- Format arbitrary unit nicely HOT 4
- Degrees celsius get converted to Kelvin in operations HOT 6
- Function to remove a single user defined unit HOT 2
- Try to start a PR for adding support for KPa, MPa, GPa but permission denied HOT 3
- Using to_string for scalars causes crashes HOT 2
- Use of uninitialised memory in unit maps HOT 7
- "Stress testing" units' string parsing HOT 8
- Favoring SI base units in string formatting? HOT 3
- to_string strange output HOT 4
- expression did not evaluate to a constant HOT 4
- Unary negation of measurements HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from units.