lib/phys/units/utils.rb in phys-units-0.9.2 vs lib/phys/units/utils.rb in phys-units-0.9.3

- old
+ new

@@ -7,10 +7,11 @@ # You can distribute/modify this program under the terms of # the GNU General Public License version 3 or later. module Phys class Unit + # @visibility private module Utils module_function def as_numeric(x) case x @@ -73,15 +74,15 @@ return "(1/%s)" % Rational(d,n).to_f.inspect end end ud,nd = n_trail_zero(d) if nd > 3 - return Rational(n,ud).inspect + + return Rational(n,ud).inspect + ("*%.0e"%10**(-nd)) end un,nn = n_trail_zero(n) if nn > 3 - return Rational(un,d).inspect + + return Rational(un,d).inspect + ("*%.0e"%10**(nn)) end end x.inspect end