boost::units - converting from one derived_dimension to another across systems (imperial to metric)

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

boost::units - converting from one derived_dimension to another across systems (imperial to metric)

Boost - Users mailing list
Eisuke Kawashima: Thank You.  I'll have a look.  When I saw Boost.Units did not have imperial and we had to create it ourselves, I thought: the US is s 5 trillion dollar market, most of those markets need programming, all are on imperial.  Boost.Units needs imperial and programmers would find and use it.

Steven Watanabe:  Thank You. 
This solution doesn't seem correct as it does not consider "length"....
boost::units::derived_dimension<
  boost::units::mass_base_dimension, 1,
  boost::units::time_base_dimension, -2>::type
I thought I'd at it (L M T^-2 L-1) but this didn't do well.:
        typedef boost::units::derived_dimension<
            boost::units::length_base_dimension, 1,
            boost::units::mass_base_dimension, 1,
            boost::units::time_base_dimension, -2,
            boost::units::length_base_dimension, -1
        >::type
            lineal_force_dimension;


So, I tried the " typedef boost::mpl::divides<...>" solution as it has force and length.  I am closer, I hope.

*.h------------------------------------------------------------------------------------------------------------------------------------------
namespace dimensional_analysis {

      typedef boost::units::length_base_dimension::dimension_type length_dimension;
      typedef boost::units::mass_base_dimension::dimension_type mass_dimension;

      typedef boost::units::make_system<
            boost::units::us::inch_base_unit,
            boost::units::us::pound_base_unit
        >::type ip_system;

    namespace lineal_force {
        typedef boost::mpl::divides<
            boost::units::force_dimension,
            boost::units::length_dimension>::type
            lineal_force_dimension;
        namespace imperial {
            typedef boost::units::unit<
                lineal_force_dimension,
                dimensional_analysis ::ip_system
            > lineal_force_unit;
            typedef boost::units::quantity<lineal_force_unit, double> pound_per_in_quantity;
            BOOST_UNITS_STATIC_CONSTANT(pound_per_inch, pound_per_in_quantity);
        }
        namespace si {
            typedef boost::units::unit<
                lineal_force_dimension,
                boost::units::si::system
            > lineal_force_unit;
            typedef boost::units::quantity<lineal_force_dimension, double> kg_per_meter_quantity;
            BOOST_UNITS_STATIC_CONSTANT(kg_per_meter, kg_per_meter_quantity);
        }
    }//lineal_force
}//dimensional_analysis

*.cpp------------------------------------------------------------------------------------------------------------------------------------------
BOOST_UNITS_DEFINE_CONVERSION_FACTOR(dimensional_analysis::lineal_force::imperial::lineal_force_unit, dimensional_analysis::lineal_force::si::lineal_force_unit, double, 17.858); // exact conversion
BOOST_UNITS_DEFAULT_CONVERSION(dimensional_analysis::lineal_force::imperial::lineal_force_unit, dimensional_analysis::lineal_force::si::lineal_force_unit);

BOOST_UNITS_DEFINE_CONVERSION_FACTOR(dimensional_analysis::lineal_force::si::lineal_force_unit, dimensional_analysis::lineal_force::imperial::lineal_force_unit, double, 0.0559974); // exact conversion
BOOST_UNITS_DEFAULT_CONVERSION(dimensional_analysis::lineal_force::si::lineal_force_unit, dimensional_analysis::lineal_force::imperial::lineal_force_unit);

//This is not converting force/length and is converting si -> imperial mass (only) = 110.2.  Needs to consider force/length, =50*0.0559974
auto t1 = static_cast<boost::units::quantity<dimensional_analysis::lineal_force::imperial::lineal_force_unit>>(
50.0 * dimensional_analysis::lineal_force::si::lineal_force_unit::unit_type());

/ This is not converting force/length and i sconverting imperial -> si mass (only) = 22.7. Needs to consider force/length, =50*17.858
auto t2 = static_cast<boost::units::quantity<dimensional_analysis::lineal_force::si::lineal_force_unit>>(
50.0 * dimensional_analysis::lineal_force::imperial::lineal_force_unit::unit_type());

//This is again only converting mass and needs to convert force/length
const auto t3 = boost::units::conversion_factor(
dimensional_analysis::lineal_force::imperial::lineal_force_unit::unit_type(),
dimensional_analysis::lineal_force::si::lineal_force_unit::unit_type());



On Monday, November 19, 2018, 12:46:57 PM CST, [hidden email] <[hidden email]> wrote:


Send Boost-users mailing list submissions to

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to

You can reach the person managing the list at

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Boost-users digest..."


Today's Topics:

  1. Re: boost::units - converting from one derived_dimension to
      another across systems (imperial to metric) (Eisuke Kawashima)
  2. Re: Fwd: Boost::Filesystem - How to iterate, through the
      whole drive (Richard Z?vodn?)
  3. Re: boost::units - converting from one derived_dimension to
      another across systems (imperial to metric) (Steven Watanabe)
  4. Re: [release] Boost 1.69.0 Beta 1 (Marshall Clow)


----------------------------------------------------------------------

Message: 1
Date: Tue, 20 Nov 2018 02:23:10 +0900
From: Eisuke Kawashima <e.kawaschima+[hidden email]>
Subject: Re: [Boost-users] boost::units - converting from one
    derived_dimension to another across systems (imperial to metric)
Message-ID:
Content-Type: text/plain; charset="UTF-8"

Hi list,

> I am having trouble converting from one derived_dimension to another across systems (imperial to metric).  I'd like to convert, say, lb/in to, say, kg/m.  I thought I would do the following but get a compiler error #:
>
> *.h--------------------------------------------------------------------------------
> namespace dimensional_analysis {
>    namespace lineal_force {
>        //lb/in
>        typedef boost::units::derived_dimension<
>            boost::units::us::pound_force_base_unit, 1,
>            boost::units::us::inch_base_unit, -1
>        >::type lb_per_inch_dimension;
>        typedef boost::units::unit<
>            lb_per_inch_dimension,
>            dimensional_analysis::lengths::ip_system
>        > lb_per_inch_unit;
>        typedef boost::units::quantity<lb_per_inch_unit, double> lb_per_inch_quantity;
>        BOOST_UNITS_STATIC_CONSTANT(lbpin, lb_per_inch_quantity);
>          //kg/m
>        typedef boost::units::derived_dimension<
>            boost::units::si::kilogram_base_unit, 1,
>            boost::units::si::meter_base_unit, -1
>        >::type kg_per_meter_dimension;
>        typedef boost::units::unit<
>            kg_per_meter_dimension,
>            boost::units::si::system
>        > kg_per_meter_unit;
>        typedef boost::units::quantity<kg_per_meter_unit, double> kg_per_meter_unit_quantity;
>        BOOST_UNITS_STATIC_CONSTANT(kgpm, kg_per_meter_unit_quantity);
>    }//lineal_force
> }//dimensional_analysis
>
> *.cp ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> //Do I need these?
> BOOST_UNITS_DEFINE_CONVERSION_FACTOR(dimensional_analysis::lineal_force::kg_per_meter_unit, dimensional_analysis::lineal_force::lb_per_inch_unit, double, 0.0559974); // exact conversion
> BOOST_UNITS_DEFAULT_CONVERSION(dimensional_analysis::lineal_force::kg_per_meter_unit, dimensional_analysis::lineal_force::lb_per_inch_unit);
>
> //This does not compile#
> const auto conv_factor_try0 = conversion_factor(dimensional_analysis::lineal_force::kg_per_meter_unit::unit_type(), dimensional_analysis::lineal_force::lb_per_inch_unit::unit_type());
>
> # *\boost_1_68_0\boost\units\detail\conversion_impl.hpp(340): error C2672: 'conversion_factor': no matching overloaded function found (compiling source file...*.cpp)
>
> Any help is appreciated

such a situation;
the following code

```cpp
#include <iostream>
#include <boost/units/base_units/us/inch.hpp>
#include <boost/units/base_units/us/pound_force.hpp>
#include <boost/units/io.hpp>
#include <boost/units/physical_dimensions.hpp>
#include <boost/units/systems/si.hpp>

int main() {
  auto force_us{1.0 * boost::units::us::pound_force};
  auto length_us{1.0 * boost::units::us::inch};
  boost::units::quantity<boost::units::si::force, double> force_si{force_us};
  boost::units::quantity<boost::units::si::length, double> length_si{length_us};
  std::cout << force_us << " = " << force_si << '\n';
  std::cout << length_us << " = " << length_si << '\n';
  std::cout << force_us / length_us << " = " << force_si / length_si << '\n';
  return 0;
}
```

will print

```
1 lbf = 4.44822 m kg s^-2
1 in = 0.0254 m
1 lbf in^-1 = 175.127 kg s^-2
```

Best

--
Eisuke Kawashima


------------------------------

Message: 2
Date: Mon, 19 Nov 2018 19:24:58 +0100
From: Richard Z?vodn? <[hidden email]>
Subject: Re: [Boost-users] Fwd: Boost::Filesystem - How to iterate,
    through the whole drive
Message-ID: <[hidden email]>
Content-Type: text/plain; charset="utf-8"; Format="flowed"

I just wanna try it again here, maybe somebody will shop up who knows
where is the problem as I unfortunately couldn't fix it with degski (but
still, thank you for your time :)). His example (can be found below)
doesn't work on my system. The problem is I can't start iteration from
the drive root (for example E:\), because it will iterate only the
directory above (E:\projects\boost\build) the directory that the
executable is located in (the executable is located in
E:\projects\boost\build\Debug). What is weird that if I move the
executable to the different directory (let's say
C:\Users\USER_NAME\Downloads) it will still iterate only the build
directory. I tried to play with Visual Studio -> PROJECT_NAME ->
Properties -> Debugging -> Working Directory, but without a success.
According to degski he has the value of this entry set to $(ProjectDir)
which is the same value as mine. Thank you.

On 11/18/2018 9:04 AM, degski wrote:
> On Sun, 18 Nov 2018 at 05:31, Richard Z?vodn? via Boost-users
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>
>
>    ---------- Forwarded message ---------
>    From: *Richard Z?vodn?* <[hidden email]
>    <mailto:[hidden email]>>
>    Date: Sat, Nov 17, 2018, 3:59 PM
>    Subject: Boost::Filesystem - How to iterate, through the whole drive
>    To: <[hidden email] <mailto:[hidden email]>>
>
>
>    Hey guys, I need iterate over all directories from starting path.
>    If I start iterating from C:\some-dir it works very well, however
>    if I try to iterate from C:\, it doesn't work. How can iterate
>    through the whole drive? Thank you.
>
>
>    Code is here: https://pastebin.com/mpsKJxH2
>    <https://pastebin.com/3J6FEMG5>. The problem I experience is
>    commented right in the code section (line 1, 13 and 25).
>
>
> This works for me, either with boost-1.68 (not that I think that
> matters) or the STL-VC-15.9.1 (/std:c++17):
>
> #include <iostream>
> #include <boost/filesystem.hpp>
>
> namespace fs = boost::filesystem;
>
> int main ( ) {
> ??? for ( auto & p : fs::recursive_directory_iterator ( "d:\\" ) ) {
> ??????? std::cout << p.path ( ) << '\n';
> ??? }
> }
>
> Note that: "The iteration order is unspecified, except that each
> directory entry is visited only once."
>
> degski
> --
> /*/*?*/If something cannot go on forever, it will stop" - Herbert Stein*/
-------------- next part --------------
HTML attachment scrubbed and removed

------------------------------

Message: 3
Date: Mon, 19 Nov 2018 11:36:01 -0700
From: Steven Watanabe <[hidden email]>
To: Matt Vinson via Boost-users <[hidden email]>
Subject: Re: [Boost-users] boost::units - converting from one
    derived_dimension to another across systems (imperial to metric)
Message-ID: <[hidden email]>
Content-Type: text/plain; charset=utf-8

AMDG

On 11/16/2018 05:27 AM, Matt Vinson via Boost-users wrote:
> Thanks for input...Ok, I have errors creating a 'lineal force unit'.
> In our branch of engineering, we have kips****/ft, kips/in, lbs/foot, lbs/in, kN/meter, Kn/cm, KN/mm, N/meter, N/cm, N/mm, Metric Ton/meter, Metric Ton/cm, Metric Ton/mm, KiloGram/meter $, KiloGram/cm, KiloGram/mm, etc....All these units* are loosing force divided by length.
> After all the appreciated input in this thread, I thought I'd try this but it does not compile*** probably because force is "L M T^-2" and length is "L" which is not correct:?? ???? //Lineal Force
> ?? ???? typedef boost::units::derived_dimension<
> ?? ??? ??? ?boost::units::force_dimension, 1,
> ?? ??? ??? ?boost::units::length_dimension, -1
> ?? ??? ?>::type lineal_force_dimension;
>

derived_dimension works with the base_dimensions not a dimension list.
Use either:

boost::units::derived_dimension<
  boost::units::mass_base_dimension, 1,
  boost::units::time_base_dimension, -2>::type

or

boost::mpl::divides<
  boost::units::force_dimension,
  boost::units::length_dimension>::type

> How can I use Boost.Units to convert one force/length to another force/length: say, lb/in to, say, kg/m?
> *not Boost.Units**, the units in the engineering math equation**A set of base units raised to rational exponents, e.g. m^1, kg^1, m^1/s^2.
> *** ...\boost_1_68_0\boost\mpl\aux_\preprocessed\plain\less.hpp(20): error C2039: 'value': is not a member of 'boost::units::detail::dimension_list_tag'
> <snip>>

In Christ,
Steven Watanabe


------------------------------

Message: 4
Date: Mon, 19 Nov 2018 10:44:34 -0800
From: Marshall Clow <[hidden email]>
To: Boost users list <[hidden email]>
Subject: Re: [Boost-users] [release] Boost 1.69.0 Beta 1
Message-ID:
    <CAMBqOsgUjiDX+crLYDarqVtFrsnMZkSG+[hidden email]>
Content-Type: text/plain; charset="utf-8"

On Sun, Nov 18, 2018 at 6:55 PM Michael Powell via Boost-users <

> On Sun, Nov 18, 2018 at 9:29 PM Marshall Clow via Boost-users
> <[hidden email]> wrote:
> >
> > Boost release 1.69.0 beta 1 is now available at:
> >
> > The SHA256 checksums are as follows:
> >
> > ee0ecd7d31f58474c1e0210089c9e66bd878d4d1e7436ac511e359aa4a9d3e86
> ./boost_1_69_0_b1.7z
> > 3e25c46f2171799caabbeb419ba7859fffb62208f3a1c80798713377ab07af0e
> ./boost_1_69_0_b1.tar.bz2
> > 71f4b57175058af1b8c320971cf29226e5a652931a679f7e1c086655147ecafb
> ./boost_1_69_0_b1.tar.gz
> > ec9ef7d2c9f0d41f560769e67bc7ff207cc999243a7dd6c3f6bcfbdbf0827a7b
> ./boost_1_69_0_b1.zip
> >
> > For details of what's in the release, see <
> >
> > Please download the beta, give it a try, and report any problems you
> encounter.
>
> I'm confused. We just had a round of b1/rc1-3, didn't we?
>

Right. We had three "release candidates" beta1/rc1, rc2, and rc3.
This is the actual beta release - it is the same as RC3.

-- Marshall
-------------- next part --------------
HTML attachment scrubbed and removed

------------------------------

Subject: Digest Footer

_______________________________________________
Boost-users mailing list


------------------------------

End of Boost-users Digest, Vol 5041, Issue 4
********************************************

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: boost::units - converting from one derived_dimension to another across systems (imperial to metric)

Boost - Users mailing list
AMDG

On 11/19/2018 09:09 PM, Matt Vinson via Boost-users wrote:
>  Eisuke Kawashima: Thank You.  I'll have a look.  When I saw Boost.Units did not have imperial and we had to create it ourselves, I thought: the US is s 5 trillion dollar market, most of those markets need programming, all are on imperial.  Boost.Units needs imperial and programmers would find and use it.
>
> Steven Watanabe:  Thank You. 
> This solution doesn't seem correct as it does not consider "length"....

How is it wrong?  length cancels out.  The divides version
will give exactly the same type.

> boost::units::derived_dimension<
>   boost::units::mass_base_dimension, 1,
>   boost::units::time_base_dimension, -2>::typeI thought I'd at it (L M T^-2 L-1) but this didn't do well.:        typedef boost::units::derived_dimension<
>             boost::units::length_base_dimension, 1,
>             boost::units::mass_base_dimension, 1,
>             boost::units::time_base_dimension, -2,
>             boost::units::length_base_dimension, -1
>         >::type
>             lineal_force_dimension;
>

derived_dimension can't handle multiple uses of the
same base dimension.  Even if it did, it would just
cancel them out, so this serves to purpose.

> So, I tried the " typedef boost::mpl::divides<...>" solution as it has force and length.  I am closer, I hope.
> *.h------------------------------------------------------------------------------------------------------------------------------------------
> namespace dimensional_analysis {
>       typedef boost::units::length_base_dimension::dimension_type length_dimension;
>       typedef boost::units::mass_base_dimension::dimension_type mass_dimension;
>
>       typedef boost::units::make_system<
>             boost::units::us::inch_base_unit,
>             boost::units::us::pound_base_unit
>         >::type ip_system;
>
>     namespace lineal_force {
>         typedef boost::mpl::divides<
>             boost::units::force_dimension,
>             boost::units::length_dimension>::type
>             lineal_force_dimension;
>         namespace imperial {
>             typedef boost::units::unit<
>                 lineal_force_dimension,
>                 dimensional_analysis ::ip_system
>             > lineal_force_unit;
>             typedef boost::units::quantity<lineal_force_unit, double> pound_per_in_quantity;
>             BOOST_UNITS_STATIC_CONSTANT(pound_per_inch, pound_per_in_quantity);
>         }
>         namespace si {
>             typedef boost::units::unit<
>                 lineal_force_dimension,
>                 boost::units::si::system
>             > lineal_force_unit;

This is not the unit you want.  The SI
unit of force is N, not kg.  kilogram-force
is not currently provided by Boost.Units
and you'll need to define it yourself.
(As in your previous post.)

>             typedef boost::units::quantity<lineal_force_dimension, double> kg_per_meter_quantity;
>             BOOST_UNITS_STATIC_CONSTANT(kg_per_meter, kg_per_meter_quantity);
>         }
>     }//lineal_force
> }//dimensional_analysis
>  <snip>

In Christ,
Steven Watanabe
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: boost::units - converting from one derived_dimension to another across systems (imperial to metric)

Boost - Users mailing list
On Tue, 20 Nov 2018 at 07:06, Steven Watanabe via Boost-users <[hidden email]> wrote:
This is not the unit you want.  The SI
unit of force is N, not kg. 

One wonders what has happened to the school system these days, this is basic stuff that was taught to kids 13/14 years of age ad nauseam.

To expand on what Steven has been [economically] stating: Wikipedia definition: One newton is the force needed to accelerate one kilogram of mass at the rate of one metre per second squared in the direction of the applied force. And from Wikipedia again: ... an object with a mass of 1.0 kilogram will weigh approximately 9.81 newtons on the surface of the Earth (its mass multiplied by the gravitational field strength), since the newton is a unit of force, while the kilogram is a unit of mass.

kilogram-force
is not currently provided by Boost.Units
and you'll need to define it yourself.

From Wikipedia: Kilogram-force is a non-standard unit and is classified in SI Metric System as a unit that is unacceptable for use with SI. It is equal to the magnitude of the force exerted on one kilogram of mass in a 9.80665 m/s2 gravitational field (standard gravity, a conventional value approximating the average magnitude of gravity on Earth). Therefore, one kilogram-force is by definition equal to 9.80665 N. The "by definition" here is important, depending on where you are on the planet, the real value will vary.

In the meanwhile the Kg has been redefined. The new definition is based on invariant constants of nature. Is there anything Boost needs to do to comply with this new definition [or does it require serious multi-precision to actually see a difference [I suspect so, but still it should be defined in terms of these constants]]? The constant that did get redefined to make this [the above Kg definition] possible is the Planck constant.

The new value [as of 20 May 2019] of the Planck constant by the ISO standard is set to 6.626 070 150 x 10-34 J⋅s. Some other constants got redefined as well: ... in order to support the redefinition of the SI base units, CODATA made a special release that was published in October 2017.[30] It incorporates all data up to 1 July 2017 and determines the final numerical values of the Planck constant, h, Elementary charge, e, Boltzmann constant, k, and Avogadro constant, NA, that are to be used for the new SI definitions.

degski
--
If something cannot go on forever, it will stop" - Herbert Stein

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: boost::units - converting from one derived_dimension to another across systems (imperial to metric)

Boost - Users mailing list
In the meanwhile the Kg has been redefined. The new definition is based on invariant constants of nature.

I doubt it. The redefinition was done to eliminate a physical reference standard (there is no longer a need to compare various national lumps of platinum/iridium against a lump in France). It's not like 1 kg suddenly became 1.1 kg according to the new standard.

On Tue, Nov 20, 2018, 2:32 AM degski via Boost-users <[hidden email] wrote:
On Tue, 20 Nov 2018 at 07:06, Steven Watanabe via Boost-users <[hidden email]> wrote:
This is not the unit you want.  The SI
unit of force is N, not kg. 

One wonders what has happened to the school system these days, this is basic stuff that was taught to kids 13/14 years of age ad nauseam.

To expand on what Steven has been [economically] stating: Wikipedia definition: One newton is the force needed to accelerate one kilogram of mass at the rate of one metre per second squared in the direction of the applied force. And from Wikipedia again: ... an object with a mass of 1.0 kilogram will weigh approximately 9.81 newtons on the surface of the Earth (its mass multiplied by the gravitational field strength), since the newton is a unit of force, while the kilogram is a unit of mass.

kilogram-force
is not currently provided by Boost.Units
and you'll need to define it yourself.

From Wikipedia: Kilogram-force is a non-standard unit and is classified in SI Metric System as a unit that is unacceptable for use with SI. It is equal to the magnitude of the force exerted on one kilogram of mass in a 9.80665 m/s2 gravitational field (standard gravity, a conventional value approximating the average magnitude of gravity on Earth). Therefore, one kilogram-force is by definition equal to 9.80665 N. The "by definition" here is important, depending on where you are on the planet, the real value will vary.

In the meanwhile the Kg has been redefined. The new definition is based on invariant constants of nature. Is there anything Boost needs to do to comply with this new definition [or does it require serious multi-precision to actually see a difference [I suspect so, but still it should be defined in terms of these constants]]? The constant that did get redefined to make this [the above Kg definition] possible is the Planck constant.

The new value [as of 20 May 2019] of the Planck constant by the ISO standard is set to 6.626 070 150 x 10-34 J⋅s. Some other constants got redefined as well: ... in order to support the redefinition of the SI base units, CODATA made a special release that was published in October 2017.[30] It incorporates all data up to 1 July 2017 and determines the final numerical values of the Planck constant, h, Elementary charge, e, Boltzmann constant, k, and Avogadro constant, NA, that are to be used for the new SI definitions.

degski
--
If something cannot go on forever, it will stop" - Herbert Stein
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: boost::units - converting from one derived_dimension to another across systems (imperial to metric)

Boost - Users mailing list
On Tue, 20 Nov 2018 at 10:38, Nathan Ernst <[hidden email]> wrote:
In the meanwhile the Kg has been redefined. The new definition is based on invariant constants of nature.

It's not like 1 kg suddenly became 1.1 kg according to the new standard.

Darn, I was hoping it would go down instead and stuff would get a lot cheaper ;-).

degski
--
If something cannot go on forever, it will stop" - Herbert Stein

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: boost::units - converting from one derived_dimension to another across systems (imperial to metric)

Boost - Users mailing list
In reply to this post by Boost - Users mailing list
On Tue, 20 Nov 2018 at 10:31, degski <[hidden email]> wrote:
The new value [as of 20 May 2019] of the Planck constant by the ISO standard is set to 6.626 070 150 x 10-34 J⋅s.

The currently defined value is:

/// Planck constant
BOOST_UNITS_PHYSICAL_CONSTANT(h,quantity<energy_time>,6.62606896e-34*joule*seconds,3.3e-41*joule*seconds);

 Hmmm, that's not a fun problem, thinking about it [in terms of Boost releases of before and after 20th of May 2019].

degski
--
If something cannot go on forever, it will stop" - Herbert Stein

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: boost::units - converting from one derived_dimension to another across systems (imperial to metric)

Boost - Users mailing list
On Tue, 20 Nov 2018 at 12:37, degski <[hidden email]> wrote:
On Tue, 20 Nov 2018 at 10:31, degski <[hidden email]> wrote:
The new value [as of 20 May 2019] of the Planck constant by the ISO standard is set to 6.626 070 150 x 10-34 J⋅s.

The currently defined value is:

/// Planck constant
BOOST_UNITS_PHYSICAL_CONSTANT(h,quantity<energy_time>,6.62606896e-34*joule*seconds,3.3e-41*joule*seconds);

 Hmmm, that's not a fun problem, thinking about it [in terms of Boost releases of before and after 20th of May 2019].

The "new" Planck constant works pretty well with IEEE754, it [6.626 070 150 x 10-3] will be represented as 6.62607014999999983e-34, so not bad.

degski
--
If something cannot go on forever, it will stop" - Herbert Stein

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users