Date: Tue, 18 Jun 2024 15:17:40 +0100
Hi,
On 18/06/2024 14:54, Mateusz Pusz via Std-Proposals wrote:
> Hi,
>
> Tiago, some time has passed since your last complaint about the same
> problem. We invited you to our internal meeting, listened to your
> concerns, and discussed how we can improve here. As you know, the answer
> was not found at the meeting. Additionally, you stated that you don't
> want to work to contribute to our proposal and repository and that you
> will come back with a better interface soon. More info can be found
> here: https://github.com/mpusz/mp-units/discussions/552
> <https://github.com/mpusz/mp-units/discussions/552>. Did you manage to
> find a better solution to this problem? If so we are open to
> rediscuss your solution whenever you are ready.
>
> For all other participants of this mailing list, here is a correct solution:
>
> #include <mp-units/ostream.h>
> #include <mp-units/systems/si.h>
> #include <iostream>
>
> using namespace mp_units;
>
> inline constexpr struct atmospheric_pressure final : named_unit<"atm",
> mag<101'325> * si::pascal> {} atmospheric_pressure;
>
> int main()
> {
> using namespace mp_units::si::unit_symbols;
>
> quantity Volume = 1.0 * m3;
> quantity_point Temperature(28.0 * deg_C);
> quantity n_ = 0.04401 * kg / mol;
> quantity R_boltzman = 8.314 * N * m / (K * mol);
> quantity mass = 40.0 * kg;
> quantity Pressure = R_boltzman *
> Temperature.in(K).quantity_from_zero() * mass / n_ / Volume;
> std::cout << Pressure.in(Pa) << "(" <<
> Pressure.in(atmospheric_pressure) << ")\n";
> }
>
> https://godbolt.org/z/E8bf51hKG <https://godbolt.org/z/E8bf51hKG>
>
> Temperatures are tricky, and there is no good default here.
In my opinion if there is no good default then there shouldn't be one.
This is probably easier said than done. Or maybe it's just a naming
issue, and naming a relative measurement unit as `deg_C` just asks for
trouble.
In my Physics education I think the common advice was to just avoid
using °C altogether. So it's not like the issue only hits computer unit
libraries, it can manifest with pen and paper just as well. I think just
ditching `deg_C` as convenient shorthand could at least mitigate one
footgun.
> People often
> mean either a point or a difference, depending on the context. In case
> anyone has an idea on how to improve, we are open to feedback.
>
> Best
>
> Mat
>
> wt., 18 cze 2024 o 15:30 Sebastian Wittmeier via Std-Proposals
> <std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]>>
> napisał(a):
>
> __
>
> How about the following scales? Are they also an issue?
>
> - Time (Calendar) relative to either anno domini or Unix time?
> - Position Coordinate relative to Greenwich?
> - Electric Potential relative to earth potential?
> - pH, pKa, pKb scales relative to a neutrality of 7?
> - Decibels, phon and sone relative to threshold of human hearing?
> - Pressure (hydraulic or blood) relative to atmospheric pressure?
> - Altitude relative to sea level?
>
> -> For pressure and altitude there are lots of other scales,
> e.g. used in aviation
> - Richter scale relative to detectable earthquakes?
> - Beaufort relative to calm wind instead of zero wind?
> - Borg physical exertion not starting at zero?
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden] <mailto:Std-Proposals_at_[hidden]>
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
> <https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals>
>
>
> wt., 18 cze 2024 o 15:44 Tiago Freire via Std-Proposals
> <std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]>>
> napisał(a):
>
> I understand what the problem is, that is why I’m bringing it
> forward.____
>
> My concerned is that I haven’t written any code that anyone wouldn’t
> have written and got the wrong answer.____
>
> __ __
>
> > An absolute value in the paper is a quantity_point, a possibly
> relative value is a quantity.____
>
> __ __
>
> Which is a perspective, not convinced that it is the right thing.
> But That also poses the question, volume is also an absolute value,
> so is the mass, pressure, etc..____
>
> __ __
>
> Which means that the right way to write it would be this:____
>
> ```____
>
> quantity_point Volume {1.0 * m*m*m};____
>
> quantity_point Temperature {si::ice_point + 28.0 * deg_C};____
>
> quantity_point n_{0.04401 * kg / mol};____
>
> quantity R_boltzman = 8.314 * N * m / (K * mol);____
>
> quantity_point mass {40.0 * kg};____
>
> quantity_point P = R_boltzman * Temperature * mass / n_ / Volume;____
>
> std::cout << Pressure << std::endl;____
>
> ```____
>
> __ __
>
> But this doesn’t compile because quantity_point can’t math.____
>
> In order to get it to compile you would have to do this instead:____
>
> ```____
>
> quantity_point Pressure = quantity_point{0.0*Pa} + R_boltzman *
> (Temperature - mp_units::si::absolute_zero) * (mass -
> quantity_point{0.0*kg}) / (n_ - quantity_point{0.0*kg / mol}) /
> (Volume - quantity_point{0.0* m*m*m});____
>
> ```____
>
> Which doesn’t even module the problem properly because the values in
> PV=nRT are supposed to be absolute values, not deltas.____
>
> __ __
>
> Hence it raises the question, doing what it seems obvious is the
> wrong thing (thus questionably safe), and doing the right thing is
> kind of hard (thus questionably user-friendly). But that what is
> expected as the correct way to use it.____
>
> __ __
>
> __ __
>
> *From:*Std-Proposals <std-proposals-bounces_at_[hidden]
> <mailto:std-proposals-bounces_at_[hidden]>> *On Behalf Of
> *Sebastian Wittmeier via Std-Proposals
> *Sent:* Tuesday, June 18, 2024 15:03
> *To:* std-proposals_at_[hidden]
> <mailto:std-proposals_at_[hidden]>
> *Cc:* Sebastian Wittmeier <wittmeier_at_[hidden]
> <mailto:wittmeier_at_[hidden]>>
> *Subject:* Re: [std-proposals] On the standardization of mp-units
> P3045R1____
>
> __ __
>
> You are specifically talking about____
>
> ____
>
> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3045r1.html#potential-surprises-while-working-with-temperatures <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3045r1.html#potential-surprises-while-working-with-temperatures>____
>
> ____
>
> ____
>
> Discussing the difficulty, when to use a difference in temperature
> or an absolute temperature.____
>
> ____
>
> An absolute value in the paper is a quantity_point, a possibly
> relative value is a quantity.____
>
> ____
>
> ____
>
> If I understand correctly, in the current paper to initialize and
> use absolute temperatures____
>
> ____
>
> |quantity_point qp2 = (isq::Celsius_temperature(28.0 * deg_C)).in(K)|
>
> |and|
>
> |qp2.quantity_from_zero()|____
>
> ____
>
> ____
>
> would have to be used instead of____
>
> __ __
>
> quantity Temperature = (28.0 * deg_C).in(K);____
>
> ____
>
> The paper also says____
>
> ____
>
> "We have added the Celsius temperature quantity type for
> completeness and to gain more experience with it. Still, maybe a
> good decision would be to skip it in the standardization process not
> to confuse users."____
>
>
> ____
>
> ____
>
> ____
>
> ____
>
>
> ____
>
> -----Ursprüngliche Nachricht-----
> *Von:* Sebastian Wittmeier <wittmeier_at_[hidden]
> <mailto:wittmeier_at_[hidden]>>
> *Gesendet:* Di 18.06.2024 14:42
> *Betreff:* AW: [std-proposals] On the standardization of
> mp-units P3045R1
> *An:* std-proposals_at_[hidden]
> <mailto:std-proposals_at_[hidden]>; ____
>
> Hi Tiago,____
>
> where does this difference of 11x come from?____
>
> The temperature with 28°C vs. 301K?
> ____
>
> -----Ursprüngliche Nachricht-----
> *Von:* Tiago Freire via Std-Proposals
> <std-proposals_at_[hidden]
> <mailto:std-proposals_at_[hidden]>>
> *Gesendet:* Di 18.06.2024 14:28
> *Betreff:* [std-proposals] On the standardization of
> mp-units P3045R1
> *An:* std-proposals_at_[hidden]
> <mailto:std-proposals_at_[hidden]>;
> *CC:* Tiago Freire <tmiguelf_at_[hidden]
> <mailto:tmiguelf_at_[hidden]>>; ____
>
> Hi, I will be participating in St. Louis.____
>
> And one of the papers that interested me was P3045R1,
> unfortunately I may or may not be on time to participate in
> this particular session.____
>
> ____
>
> There’s this question that I would like an answer too, and I
> wonder if there is anyone who will be attending St. Louis
> who would be willing to make this question on my behalf:____
>
> ____
>
> ____
>
> ____
>
> A lab worker puts in 40Kg of dry ice into a 1 cubic meter
> pressure tank rated for 10atm, they then vacuum the tank and
> seal it.____
>
> As the CO2 warms up to room temperature (which at a specific
> date was 28°C) it evaporates, and eventually following the
> ideal gas law:____
>
> PV=nRT____
>
> ____
>
> Is this setup dangerous?____
>
> ____
>
> Using mp-units (with the exact same design as the one being
> proposed for standardization) to solve this problem:____
>
> ____
>
> ```____
>
> quantity Volume = 1.0 * m*m*m;____
>
> quantity Temperature = (28.0 * deg_C).in(K);____
>
> quantity n_ = 0.04401 * kg / mol;____
>
> quantity R_boltzman = 8.314 * N * m / (K * mol);____
>
> quantity mass = 40.0 * kg;____
>
> quantity Pressure = R_boltzman * Temperature * mass / n_ /
> Volume;____
>
> std::cout << Pressure << std::endl;____
>
> ```____
>
> ____
>
> We get the following result:____
>
> `211581 N/m2`____
>
> (=211.581kPa = 2,09 atm)____
>
> But the correct answer is actually: 2275.629kPa = 22.5 atm____
>
> (11 time s higher than what mp-units calculated)____
>
> ____
>
> How is this considered a design feature and not a bug? (note
> that other similar libraries don’t have this problem)____
>
> And how do the authors think this design choice impacts on
> safety and user-friendliness?____
>
> ____
>
> ____
>
> Thanks.____
>
> ____
>
> __ __
>
> -- Std-Proposals mailing listStd-Proposals_at_[hidden] <mailto:Std-Proposals_at_[hidden]> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals <https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals> ____
>
> ____
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden] <mailto:Std-Proposals_at_[hidden]>
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
> <https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals>
>
>
On 18/06/2024 14:54, Mateusz Pusz via Std-Proposals wrote:
> Hi,
>
> Tiago, some time has passed since your last complaint about the same
> problem. We invited you to our internal meeting, listened to your
> concerns, and discussed how we can improve here. As you know, the answer
> was not found at the meeting. Additionally, you stated that you don't
> want to work to contribute to our proposal and repository and that you
> will come back with a better interface soon. More info can be found
> here: https://github.com/mpusz/mp-units/discussions/552
> <https://github.com/mpusz/mp-units/discussions/552>. Did you manage to
> find a better solution to this problem? If so we are open to
> rediscuss your solution whenever you are ready.
>
> For all other participants of this mailing list, here is a correct solution:
>
> #include <mp-units/ostream.h>
> #include <mp-units/systems/si.h>
> #include <iostream>
>
> using namespace mp_units;
>
> inline constexpr struct atmospheric_pressure final : named_unit<"atm",
> mag<101'325> * si::pascal> {} atmospheric_pressure;
>
> int main()
> {
> using namespace mp_units::si::unit_symbols;
>
> quantity Volume = 1.0 * m3;
> quantity_point Temperature(28.0 * deg_C);
> quantity n_ = 0.04401 * kg / mol;
> quantity R_boltzman = 8.314 * N * m / (K * mol);
> quantity mass = 40.0 * kg;
> quantity Pressure = R_boltzman *
> Temperature.in(K).quantity_from_zero() * mass / n_ / Volume;
> std::cout << Pressure.in(Pa) << "(" <<
> Pressure.in(atmospheric_pressure) << ")\n";
> }
>
> https://godbolt.org/z/E8bf51hKG <https://godbolt.org/z/E8bf51hKG>
>
> Temperatures are tricky, and there is no good default here.
In my opinion if there is no good default then there shouldn't be one.
This is probably easier said than done. Or maybe it's just a naming
issue, and naming a relative measurement unit as `deg_C` just asks for
trouble.
In my Physics education I think the common advice was to just avoid
using °C altogether. So it's not like the issue only hits computer unit
libraries, it can manifest with pen and paper just as well. I think just
ditching `deg_C` as convenient shorthand could at least mitigate one
footgun.
> People often
> mean either a point or a difference, depending on the context. In case
> anyone has an idea on how to improve, we are open to feedback.
>
> Best
>
> Mat
>
> wt., 18 cze 2024 o 15:30 Sebastian Wittmeier via Std-Proposals
> <std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]>>
> napisał(a):
>
> __
>
> How about the following scales? Are they also an issue?
>
> - Time (Calendar) relative to either anno domini or Unix time?
> - Position Coordinate relative to Greenwich?
> - Electric Potential relative to earth potential?
> - pH, pKa, pKb scales relative to a neutrality of 7?
> - Decibels, phon and sone relative to threshold of human hearing?
> - Pressure (hydraulic or blood) relative to atmospheric pressure?
> - Altitude relative to sea level?
>
> -> For pressure and altitude there are lots of other scales,
> e.g. used in aviation
> - Richter scale relative to detectable earthquakes?
> - Beaufort relative to calm wind instead of zero wind?
> - Borg physical exertion not starting at zero?
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden] <mailto:Std-Proposals_at_[hidden]>
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
> <https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals>
>
>
> wt., 18 cze 2024 o 15:44 Tiago Freire via Std-Proposals
> <std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]>>
> napisał(a):
>
> I understand what the problem is, that is why I’m bringing it
> forward.____
>
> My concerned is that I haven’t written any code that anyone wouldn’t
> have written and got the wrong answer.____
>
> __ __
>
> > An absolute value in the paper is a quantity_point, a possibly
> relative value is a quantity.____
>
> __ __
>
> Which is a perspective, not convinced that it is the right thing.
> But That also poses the question, volume is also an absolute value,
> so is the mass, pressure, etc..____
>
> __ __
>
> Which means that the right way to write it would be this:____
>
> ```____
>
> quantity_point Volume {1.0 * m*m*m};____
>
> quantity_point Temperature {si::ice_point + 28.0 * deg_C};____
>
> quantity_point n_{0.04401 * kg / mol};____
>
> quantity R_boltzman = 8.314 * N * m / (K * mol);____
>
> quantity_point mass {40.0 * kg};____
>
> quantity_point P = R_boltzman * Temperature * mass / n_ / Volume;____
>
> std::cout << Pressure << std::endl;____
>
> ```____
>
> __ __
>
> But this doesn’t compile because quantity_point can’t math.____
>
> In order to get it to compile you would have to do this instead:____
>
> ```____
>
> quantity_point Pressure = quantity_point{0.0*Pa} + R_boltzman *
> (Temperature - mp_units::si::absolute_zero) * (mass -
> quantity_point{0.0*kg}) / (n_ - quantity_point{0.0*kg / mol}) /
> (Volume - quantity_point{0.0* m*m*m});____
>
> ```____
>
> Which doesn’t even module the problem properly because the values in
> PV=nRT are supposed to be absolute values, not deltas.____
>
> __ __
>
> Hence it raises the question, doing what it seems obvious is the
> wrong thing (thus questionably safe), and doing the right thing is
> kind of hard (thus questionably user-friendly). But that what is
> expected as the correct way to use it.____
>
> __ __
>
> __ __
>
> *From:*Std-Proposals <std-proposals-bounces_at_[hidden]
> <mailto:std-proposals-bounces_at_[hidden]>> *On Behalf Of
> *Sebastian Wittmeier via Std-Proposals
> *Sent:* Tuesday, June 18, 2024 15:03
> *To:* std-proposals_at_[hidden]
> <mailto:std-proposals_at_[hidden]>
> *Cc:* Sebastian Wittmeier <wittmeier_at_[hidden]
> <mailto:wittmeier_at_[hidden]>>
> *Subject:* Re: [std-proposals] On the standardization of mp-units
> P3045R1____
>
> __ __
>
> You are specifically talking about____
>
> ____
>
> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3045r1.html#potential-surprises-while-working-with-temperatures <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3045r1.html#potential-surprises-while-working-with-temperatures>____
>
> ____
>
> ____
>
> Discussing the difficulty, when to use a difference in temperature
> or an absolute temperature.____
>
> ____
>
> An absolute value in the paper is a quantity_point, a possibly
> relative value is a quantity.____
>
> ____
>
> ____
>
> If I understand correctly, in the current paper to initialize and
> use absolute temperatures____
>
> ____
>
> |quantity_point qp2 = (isq::Celsius_temperature(28.0 * deg_C)).in(K)|
>
> |and|
>
> |qp2.quantity_from_zero()|____
>
> ____
>
> ____
>
> would have to be used instead of____
>
> __ __
>
> quantity Temperature = (28.0 * deg_C).in(K);____
>
> ____
>
> The paper also says____
>
> ____
>
> "We have added the Celsius temperature quantity type for
> completeness and to gain more experience with it. Still, maybe a
> good decision would be to skip it in the standardization process not
> to confuse users."____
>
>
> ____
>
> ____
>
> ____
>
> ____
>
>
> ____
>
> -----Ursprüngliche Nachricht-----
> *Von:* Sebastian Wittmeier <wittmeier_at_[hidden]
> <mailto:wittmeier_at_[hidden]>>
> *Gesendet:* Di 18.06.2024 14:42
> *Betreff:* AW: [std-proposals] On the standardization of
> mp-units P3045R1
> *An:* std-proposals_at_[hidden]
> <mailto:std-proposals_at_[hidden]>; ____
>
> Hi Tiago,____
>
> where does this difference of 11x come from?____
>
> The temperature with 28°C vs. 301K?
> ____
>
> -----Ursprüngliche Nachricht-----
> *Von:* Tiago Freire via Std-Proposals
> <std-proposals_at_[hidden]
> <mailto:std-proposals_at_[hidden]>>
> *Gesendet:* Di 18.06.2024 14:28
> *Betreff:* [std-proposals] On the standardization of
> mp-units P3045R1
> *An:* std-proposals_at_[hidden]
> <mailto:std-proposals_at_[hidden]>;
> *CC:* Tiago Freire <tmiguelf_at_[hidden]
> <mailto:tmiguelf_at_[hidden]>>; ____
>
> Hi, I will be participating in St. Louis.____
>
> And one of the papers that interested me was P3045R1,
> unfortunately I may or may not be on time to participate in
> this particular session.____
>
> ____
>
> There’s this question that I would like an answer too, and I
> wonder if there is anyone who will be attending St. Louis
> who would be willing to make this question on my behalf:____
>
> ____
>
> ____
>
> ____
>
> A lab worker puts in 40Kg of dry ice into a 1 cubic meter
> pressure tank rated for 10atm, they then vacuum the tank and
> seal it.____
>
> As the CO2 warms up to room temperature (which at a specific
> date was 28°C) it evaporates, and eventually following the
> ideal gas law:____
>
> PV=nRT____
>
> ____
>
> Is this setup dangerous?____
>
> ____
>
> Using mp-units (with the exact same design as the one being
> proposed for standardization) to solve this problem:____
>
> ____
>
> ```____
>
> quantity Volume = 1.0 * m*m*m;____
>
> quantity Temperature = (28.0 * deg_C).in(K);____
>
> quantity n_ = 0.04401 * kg / mol;____
>
> quantity R_boltzman = 8.314 * N * m / (K * mol);____
>
> quantity mass = 40.0 * kg;____
>
> quantity Pressure = R_boltzman * Temperature * mass / n_ /
> Volume;____
>
> std::cout << Pressure << std::endl;____
>
> ```____
>
> ____
>
> We get the following result:____
>
> `211581 N/m2`____
>
> (=211.581kPa = 2,09 atm)____
>
> But the correct answer is actually: 2275.629kPa = 22.5 atm____
>
> (11 time s higher than what mp-units calculated)____
>
> ____
>
> How is this considered a design feature and not a bug? (note
> that other similar libraries don’t have this problem)____
>
> And how do the authors think this design choice impacts on
> safety and user-friendliness?____
>
> ____
>
> ____
>
> Thanks.____
>
> ____
>
> __ __
>
> -- Std-Proposals mailing listStd-Proposals_at_[hidden] <mailto:Std-Proposals_at_[hidden]> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals <https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals> ____
>
> ____
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden] <mailto:Std-Proposals_at_[hidden]>
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
> <https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals>
>
>
Received on 2024-06-18 14:17:44