Boost logo

Boost Users :

Subject: Re: [Boost-users] [units] Dimensionless? expecting length+length
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2015-08-09 19:40:05

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.

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".

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at