D20284: Fix l/100 km to MPG conversion

Albert Astals Cid noreply at phabricator.kde.org
Sat Apr 13 22:34:13 BST 2019


aacid added inline comments.

INLINE COMMENTS

> convertertest.cpp:71
> +    v = c.convert(v, QStringLiteral("l/100 km"));
> +    QCOMPARE(v.number(), 8.0);
>  }

Could you please also add a test where the initial value is in say MPG and then we have the conversion to liters/100km, mpgi and l/100 km?

> madcatx wrote in fuel_efficiency.cpp:36
> l/100 km (amount of fuel needed to cross a given distance) is reciprocal to MPG (distance crossed with a given amount of fuel). KUnitConverter can only scale units by a given factor, not invert them which is what is needed to make this work. `isReciprocal` flag denotes that the conversion between the base unit (l/100 km) and the target unit shall be reciprocal.

I understand what you mean here, but i don't think that reciprocal is the word that describes this (are you a native speaker? if so maybe it's juts that my english is bad :D)

Oh, it's actually called reciprocal number too, i think here we use the inverse naming for it https://en.wikipedia.org/wiki/Multiplicative_inverse

Maybe naming it "m_isReciprocaltoDefaultUnit" would make it understand? i.e. makes it clear that that value is in relation to the default unit?

REPOSITORY
  R292 KUnitConversion

REVISION DETAIL
  https://phabricator.kde.org/D20284

To: madcatx, broulik, #frameworks, aacid
Cc: apol, aacid, meven, kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190413/a3d704c4/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list