GithubHelp home page GithubHelp logo

Comments (6)

JaapAap avatar JaapAap commented on August 15, 2024 1

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.

nholthaus avatar nholthaus commented on August 15, 2024 1

temp translations are fixed in v2.3. Thank you very much for this bug report!

from units.

nholthaus avatar nholthaus commented on August 15, 2024

from units.

MikeGitb avatar MikeGitb commented on August 15, 2024

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.

nholthaus avatar nholthaus commented on August 15, 2024

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.

JaapAap avatar JaapAap commented on August 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.