''' 1.000 e+6 grams == 1.000 e+3 grams == kilograms 1.000 e+0 grams == grams 1.000 e-3 grams == mg 1.000 e-6 grams == mcg 1.000 e-9 grams == ''' ''' possibilities: from fractions import Fraction Fraction (4, 3) -> "1.334" exponent_multiples = 3 e+0, e+3, e+6, e+9, etc. whole number length is between 1 and 3 0 -> [ 0.000, e+0 ] .000001 -> [ 1.000, e-6 ] .000999 -> [ 999.000, e-6 ] .001 -> [ 1.000, e-3 ] == threshold, if >= 1/1000 .00999 -> [ 9.990, e-3 ] .0999 -> [ 99.000, e-3 ] .999 -> [ 999.00, e-3 ] 1 -> [ 1.000, e+0 ] 999 -> [ 999.000, e+0 ] 1000 -> [ 1.000, e+3 ] == threshold, if >= 1000 -> e+3 1334 -> ["1.334", "e+3" ] 1000000 -> [ "1.000", "e+6" ] == threshold, if >= 1000000 -> e+6 1334000 -> ["1.334", "e+6" ] 1334000000 -> ["1.334", "e+9" ] 13341000000 -> ["13.341", "e+9" ] 133410000000 -> ["133.417", "e+9" ] # # get the remainder # Fraction (4, 3) -> "1 1/3" ''' ''' plan: def round (integer, previous_integer): if (integer >= 5): return previous_integer + 1 return previous_integer; import apoplast.measures.number.sci_note as sci_note sci_note.calc ( Fraction (1, 3), round = round ) '''