« Previous | Next » 

Revision 1cdcf8f3

ID1cdcf8f33d28b98e6f834bc827ad5d5729f38de8
Parent 1bf72492
Child ccbbb434

Added by Iustin Pop about 12 years ago

Rework unit parsing

Due to how conversions were implemented previously, 1TB failed to
parse on 32-bit, as we were overflowing during computation, even
though the final result would fit easily.

This patch moves the parsing of the scaling factor to a separate
function, and all the conversions are done via the Rational type
(which has unlimited arbitrary precision), and conversion to the
desired type only happens at the last step.

The unit-tests are adjusted too, unfortunately they use the same
algorithm as the code… suggestions on how to improve things are
welcome.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences