boost/units - converting forces (lbf->N)

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

boost/units - converting forces (lbf->N)

Boost - Users mailing list
To see if I understand the library, I want to create metric and imperial systems without using Boost Units predefined systems*.  Conversions between lengths are going well.  Conversion between forces are going well until pounds-force to newtons; line 182 in the link.  What am I doing wrong when lbf will not convert to newtons?

Here is my code:

Any help is appreciated.

*
//imperial
namespace boost {
namespace units {
namespace us {}}}
//si
namespace boost {
namespace units {
namespace si {}}}


_______________________________________________
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 forces (lbf->N)

Boost - Users mailing list
On Sat, 1 Dec 2018 at 15:26, Matt Vinson via Boost-users <[hidden email]> wrote:
To see if I understand the library, I want to create metric and imperial systems without using Boost Units predefined systems*.  Conversions between lengths are going well.  Conversion between forces are going well until pounds-force to newtons; line 182 in the link.  What am I doing wrong when lbf will not convert to newtons?

Gravity is not your friend [and gets in the way of what you want to do], you're not doing anything wrong [C++-wise], but you're converting hamburgers to cheeseburgers [for free], they don't convert.

The pound-force is equal to the gravitational force exerted on a mass of one avoirdupois pound on the surface of Earth. Since the 18th century, the unit has been used in low-precision measurements, for which small changes in Earth's gravity (which varies from place to place by up to half a percent) can safely be neglected.[4]

The 20th century, however, brought the need for a more precise definition. A standardized value for acceleration due to gravity was therefore needed.

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 forces (lbf->N)

Boost - Users mailing list
In reply to this post by Boost - Users mailing list
AMDG

On 12/01/2018 06:25 AM, Matt Vinson via Boost-users wrote:
> To see if I understand the library, I want to create metric and imperial systems without using Boost Units predefined systems*.  Conversions between lengths are going well.  Conversion between forces are going well until pounds-force to newtons; line 182 in the link.  What am I doing wrong when lbf will not convert to newtons?
>

There are a few problems.

- BOOST_UNITS_DEFAULT_CONVERSION takes a unit (not a
  base unit) as its second argument.
- You are defining both a kilogram_base_unit and a kilo_gram_base_unit.
  Either one will work, but you need to be consistent.  You're
  defining the conversion in terms of kilo_gram_base_unit, but
  metric::system uses kilogram_base_unit.
- The definition of a composite conversion for force is not
  needed and will be ignored.
- metric and imperial have separate definitions of second_base_unit
  with no conversion between them.
- lbf is not the same as (lbm in s^-2)

> Here is my code:
>  https://coliru.stacked-crooked.com/a/f5f80d39fbdf8013
> Any help is appreciated.
>
> *
> //imperial
> namespace boost {namespace units {
> namespace us {}}}//sinamespace boost {
> namespace units {
> namespace si {}}}
>

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
|

boost/units - converting forces (lbf->N)

Boost - Users mailing list
In reply to this post by Boost - Users mailing list
Thanks for response....
Yes, yes, yes.  I get that.  I am having trouble understanding the library; not force.  (Same as last time)

I guess I thought the library was magically accounting for gravity which is an error.

Updated:

Thank you,

On Saturday, December 1, 2018, 9:10:38 AM CST, degski <[hidden email]> wrote:


On Sat, 1 Dec 2018 at 15:26, Matt Vinson via Boost-users <[hidden email]> wrote:
To see if I understand the library, I want to create metric and imperial systems without using Boost Units predefined systems*.  Conversions between lengths are going well.  Conversion between forces are going well until pounds-force to newtons; line 182 in the link.  What am I doing wrong when lbf will not convert to newtons?


Gravity is not your friend [and gets in the way of what you want to do], you're not doing anything wrong [C++-wise], but you're converting hamburgers to cheeseburgers [for free], they don't convert.

The pound-force is equal to the gravitational force exerted on a mass of one avoirdupois pound on the surface of Earth. Since the 18th century, the unit has been used in low-precision measurements, for which small changes in Earth's gravity (which varies from place to place by up to half a percent) can safely be neglected.[4]

The 20th century, however, brought the need for a more precise definition. A standardized value for acceleration due to gravity was therefore needed.

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 forces (lbf->N)

Boost - Users mailing list
This has errors still (
lbf->N: 0.453592
,
N->lb: 0.183719
) and I am addressing them...

On Saturday, December 1, 2018, 1:03:41 PM CST, Matt Vinson <[hidden email]> wrote:


Thanks for response....
Yes, yes, yes.  I get that.  I am having trouble understanding the library; not force.  (Same as last time)

I guess I thought the library was magically accounting for gravity which is an error.

Updated:

Thank you,

On Saturday, December 1, 2018, 9:10:38 AM CST, degski <[hidden email]> wrote:


On Sat, 1 Dec 2018 at 15:26, Matt Vinson via Boost-users <[hidden email]> wrote:
To see if I understand the library, I want to create metric and imperial systems without using Boost Units predefined systems*.  Conversions between lengths are going well.  Conversion between forces are going well until pounds-force to newtons; line 182 in the link.  What am I doing wrong when lbf will not convert to newtons?


Gravity is not your friend [and gets in the way of what you want to do], you're not doing anything wrong [C++-wise], but you're converting hamburgers to cheeseburgers [for free], they don't convert.

The pound-force is equal to the gravitational force exerted on a mass of one avoirdupois pound on the surface of Earth. Since the 18th century, the unit has been used in low-precision measurements, for which small changes in Earth's gravity (which varies from place to place by up to half a percent) can safely be neglected.[4]

The 20th century, however, brought the need for a more precise definition. A standardized value for acceleration due to gravity was therefore needed.

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