Boost logo

Boost Users :

Subject: Re: [Boost-users] [units] Dimensionless? expecting length+length
From: Michael Powell (mwpowellhtx_at_[hidden])
Date: 2015-08-10 09:43:07


On Sun, Aug 9, 2015 at 7:40 PM, Gavin Lambert <gavinl_at_[hidden]> wrote:
> On 9/08/2015 10:27, Michael Powell wrote:
>>
>> I am working on some trajectory calculations, and having a strange
>> compiler error. First, great that I should get a compiler error at
>> all! Second, what am I missing?
>
> [...]
>>
>>
>> boost::units::quantity<boost::units::unit<boost::units::list<boost::units::dim<boost::units::length_base_dimension,
>> boost::units::static_rational<1L, 1L>>,
>> boost::units::dimensionless_type>,
>>
>> boost::units::heterogeneous_system<boost::units::heterogeneous_system_impl<boost::units::list<boost::units::heterogeneous_system_dim<boost::units::si::meter_base_unit,
>> boost::units::static_rational<1L, 1L>>,
>> boost::units::dimensionless_type>,
>> boost::units::list<boost::units::dim<boost::units::length_base_dimension,
>> boost::units::static_rational<1L, 1L>>,
>> boost::units::dimensionless_type>,
>> boost::units::list<boost::units::scale_list_dim<boost::units::scale<10L,
>> boost::units::static_rational<-6L, 1L>>>,
>> boost::units::dimensionless_type>>>, void>, double>
>
>
> I believe this is the "problem" here -- there's a scale of 10^-6 applied,
> presumably as a result of multiplying with milliseconds twice. I've
> encountered issues before where some of the operators don't play nicely with
> scaled units.

Sure.

> Try normalising the milliseconds to seconds before putting them in the rest
> of the formula. You should be able to do this simply by assigning them to a
> seconds quantity type instead of using "auto".

I'm not sure what you mean, "seconds quantity type"?

There would be quantity<time> ?

Which one can assign from (time_value * seconds), to arrive at seconds?

It is possible to build up a milliseconds unit, or possible a
milliseconds_to_seconds "conversion factor" ?

> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net