Comments (3)
The original conversion is lost, there is no way to store the original string in a very compact data structure. So generally the to string operations convert to the most compact representation. Still some bugs I am sure, but the general requirement was that the string produced needed to be able be converted back into the same unit.
A Bq
is a count/sec usually used in counting radioactivity so technically correct but obviously not what you might be looking for.
so options would include
units::precise_unit samples=generate_custom_count_unit(3);
addUserDefinedUnit("samples",samples);
Then it would never get mistaken for a count. and the string would produce
"samples/s" Though if you really wanted samples/second at that point
addUserDefinedUnit("samples/second", samples/precise::s);
Side Note: still need to generate more documentation on generating custom_units and custom_count_units.
from units.
As for Hz
Kind of an interesting discussion I suppose. On the systems I interact with it would be more appropriate to have Hz be defined at 2*pi*rad/s
but then the relationship of second==Hz.inv()
wouldn't work. Though there are routines in the convert methods that deal with conversions between radians, count, and moles.
As far as counting of specific things I have either used a custom_count_unit
or use the commodity field of the precise_unit type to keep track of what it is. Though based on your comment I might want to revisit the use of Bequerel in the case of count/s for string output, maybe I should just take that out of the string output as it seems to be more of niche unit and could be confusing in other fields.
from units.
added documentation
and removed Bq from the unit to string conversion since that is an uncommon unit and often was confusing.
from units.
Related Issues (20)
- Conan package HOT 12
- Convert to inverse unit incorrect HOT 1
- Issues with parsing single-letter prefixes such as for `atto` HOT 7
- 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.