Comments (6)
Quite a different issue potentially, but surely fitting under the same 'conversion fails' banner: boost.units has two notions of temperature, which they call 'relative' and 'absolute'. The underlying issue they try to solve is that temperature differences have different associated conversions than absolute temperatures: a difference of 10K equals a difference of 10 degC rather than a difference of -263.15 degC. I don't think that the library contains a notion of temperature differences? This is something really lacking for me at this point (admittedly, the boost.units solution was also problematic sometimes, and this is likely to be conceptually far from trivial).
I have to convert some temperature-related gradients (temperature changes with height) which really requires the 'relative' notion of temperatures to work correctly.
from units.
temp translations are fixed in v2.3. Thank you very much for this bug report!
from units.
from units.
I wonder if you his could be generalized: You very often want to distinguish between absolute and relative values. E.g. think about std::chrono's duration and time point. Or a location and a distance between two of them.
from units.
This is just a bug in the math that I was hoping wasn't a real use case. Treating absolute and relative temperature differently isn't really in the scope of a units library because they are totally compatible, e.g. you can add a relative temperature to an absolute, etc. That type of stuff really belongs in a vector math library that uses units as its base types.
from units.
Not sure what you mean by 'totally compatible', would you suggest that both concepts are currently supported? And what would be the relation to vector arithmetic?
For most units, my understanding is that different scales are linearly related and there really is no distinction between relative and absolute values (i.e., they have the same conversion factor). 'Relative temperature' (that is, temperature differences) also needs linear translations and acts like most other units, while the translation for absolute temperatures is affine. They are not 'compatible' in the sense of other units: while indeed one can add a relative temperature to an absolute one, adding two absolute temperatures does not seem to make much sense, while differencing two absolute temperatures would give a relative temperature which obeys different rules for translation than absolute temperature.
Currently, absolute temperatures can still be added, and differencing 20_degC-10_degC gives 10_degC, 20_K-10_k gives 10_K, which should also equal 10_C but it doesn't as the results are treated as absolute values. Hence, it is important to be able to differentiate between an absolute temperature measurement and a measurement of temperature difference (which is a quote from the boost.units designers). Matlab also supports both concepts in its unit conversions:
https://nl.mathworks.com/help/physmod/simscape/ug/thermal-unit-conversions.html
from units.
Related Issues (20)
- Conan package out of date HOT 2
- Undefined references to .name() and .abbreviation() HOT 1
- Incorrect enable_if condition for operator+ HOT 1
- Request for branch and pull request permissions HOT 5
- percent_t FROM double and TO double are different HOT 9
- 2.3.3 does not compile
- Add a way to specify units when "downcasting" to numeric type HOT 2
- Support the MSFS SDK HOT 2
- Empty base class optimization for MSVC
- Does not compile with GCC 12 HOT 1
- raw() and value() is error prone HOT 4
- [Bug] i386 (32-bit) fails to compile
- Shouldn't the naming of units::torque::foot_pound be changed
- v2 -> v3 porting HOT 2
- Need help implementing resistance as a new custom unit. HOT 2
- unit conversion emits a surprisingly high amount of instructions
- Compilation under MINGW
- Math functions not compatible with percent HOT 1
- Status of the project HOT 14
- Units are not installed as a system library 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.