Comments (6)
I tweaked the eflag so it works differently than the iflag now. So degC can be raised to a power and still maintain the unit.
from units.
Both the iflag and eflag act like an imaginary number. When you square them they go away. iflag*iflag=one
The units those flags are used on fall into a couple categories. The first is where the unit itself has some sort of directionality to it, like VAR, which nominally is identical to Watts but represent the imaginary power component of phasor. In which case squaring it and having the flag go away is exactly what you want it to do. The other is a slight hack to discriminate units that otherwise cannot be discriminated. In this case squaring them would produce the otherwise equivalent unit squared which is still valid but doesn't work as well for display purposes I suppose.
from units.
Are you implying that a different mechanism is needed to handle, e.g., degree Celsius correctly?
from units.
My understanding of mathematical operations involving temperature units is that they should be carried out in Kelvins (or Rankine). Thus when developing the temperature handling mechanism. The fact that degC*degC produced K^2 was an acceptable feature and didn't impact common uses of temperature conversion. And I couldn't find any use case where the units using the flag intersected in common use case. Obviously you can come up with one, but I am curious what practical cases you are using where this is an issue.
from units.
It didn't come up in any practical case. We were just extending our units support and ran some tests.
What you are saying sounds like we should not even allow multiplication with degree Celsius. Is there an easy way of doing that? Either in LLNL/Units or user code.
from units.
And I couldn't find any use case where the units using the flag intersected in common use case. Obviously you can come up with one, but I am curious what practical cases you are using where this is an issue.
I comes up when dealing with uncertainties: A measurement in units degC has a standard deviation in degC, but a variance of degC^2. One could argue that we can store it in Kelvin, but then we would need to make sure that operations between degC and K work and give the expected results.
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
- 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.