Some decimal values always print with exponential notation. Is there a way to get a non-exponential representation?
A. For some values, exponential notation is the only way to express the number of significant places in the coefficient. For example, expressing 5.0E+3 as 5000 keeps the value constant but cannot show the original’s two-place significance. If an application does not care about tracking significance, it is easy to remove the exponent and trailing zeroes, losing significance, but keeping the value unchanged: >>> def remove_exponent(d): … return d.quantize(Decimal(1)) if d == d.to_integral() else d.
Related Questions
- Why are values of grain size only given to 1 decimal place whereas percent sand and other data are only given as integers?
- Some decimal values always print with exponential notation. Is there a way to get a non-exponential representation?
- How do I place currency values in money-related cells or cells that require decimal places?