| 142 | } |
| 143 | |
| 144 | void Quantity::lbmToLbf() { |
| 145 | OptionalIPUnit iu = m_units.optionalCast<IPUnit>(); |
| 146 | if (!iu) { |
| 147 | LOG_AND_THROW("Cannot convert non-IP quantity " << *this << " in system " << system().valueName() << " from pound-mass to pound-force."); |
| 148 | } |
| 149 | |
| 150 | // convert from (value * lb_m^x * ...) to (value * lb_f^x * ...) |
| 151 | // lb_m^x * (1/gc)^x = lb_f^x * s^{2x} / ft^x |
| 152 | int x = baseUnitExponent("lb_m"); |
| 153 | if (x != 0) { |
| 154 | iu->lbmToLbf(); |
| 155 | m_value /= std::pow(IPUnit::gc(), x); |
| 156 | } |
| 157 | OS_ASSERT(baseUnitExponent("lb_m") == 0); |
| 158 | } |
| 159 | |
| 160 | void Quantity::lbfToLbm() { |
| 161 | OptionalIPUnit iu = m_units.optionalCast<IPUnit>(); |