Git Product home page Git Product logo

Comments (9)

oschonrock avatar oschonrock commented on June 12, 2024

What does "self contained" mean?

Like a repo which has a 1 line main() and which submodule includes mp-units@trunk and its dependencies?

It's sort of just a cut down version of trunk, really? ie trunk minus tests and other examples?

Or do they mean, actually cut down the code to a "minimal example" which produces the same symptom? Something less than 100 lines of code in a single file.

The latter would make more sense to me.

from mp-units.

emsr avatar emsr commented on June 12, 2024

from mp-units.

oschonrock avatar oschonrock commented on June 12, 2024

Taken some baby steps and reduced the above example to the below:

  1. it's not about int casting
  2. it's not about quantity casting either
  3. a single calculation won't do it, you need 2 calculations using exactly the same units. The second one breaks.
  4. a single dimension/unit won't do it, you need a combination in each calculation

Wild guess: Compiler does the "eval" of the units string for the display of the first value. And thinks it's "cached / already eval'd" for the second one...except it isn't.

[thoughtful face]

https://godbolt.org/z/mYFohP

#include <units/physical/si/velocity.h>
#include <iostream>

using namespace units;

int main()
{
  using namespace si::literals;
  Velocity auto v1 = 100km/2h;
  Velocity auto v4 = 220.1km/3h;

  std::cout << v1 << '\n';    // 50 km/h
  std::cout << v4 << '\n';    // 73.3667  (missing units)
}

from mp-units.

mpusz avatar mpusz commented on June 12, 2024

What does "self contained" mean?
It means that all the sample is in a single file without any external headers and ideally no C++ headers.

from mp-units.

oschonrock avatar oschonrock commented on June 12, 2024

If you moved this to "in progress" does that mean you are working on it?
I don't want to double up.
It "might" pop-out quickly, but this could also be a black hole, I fear?

from mp-units.

mpusz avatar mpusz commented on June 12, 2024

No, I actually thought that you work on it ;-)

from mp-units.

oschonrock avatar oschonrock commented on June 12, 2024

OK, that's fine. I will let you know how I get on. As I said, I might get stuck...

from mp-units.

mpusz avatar mpusz commented on June 12, 2024

It seems that the problem was caused by gcc and was fixed on master: https://godbolt.org/z/pJ7fC_.

from mp-units.

oschonrock avatar oschonrock commented on June 12, 2024

Phew..I was dreading this one!

from mp-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.