You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
quantity.to_string(precision=<int>) does not produce a string of the quantity with <int> decimals of precision #11131
The precision remained unused in case the format variable evaluated to the default value. #11145 should fix this. Please note, however, that the "general format" g is used rather than the "floating point format" f! So once #11145 is merged, the snippet
from astropy import units as u
q = 10.12345 * u.km
print("%s"%q.to_string(precision=4))
Activity
pllim commentedon Dec 4, 2020
Seems like it only works if a Numpy array is given.
Behavior is the same as https://numpy.org/doc/stable/reference/generated/numpy.set_printoptions.html#numpy.set_printoptions . So even if this is a bug, maybe it is a upstream bug? @mhvk ?
ludwigschwardt commentedon Dec 7, 2020
I've noticed something similar but in the context of
Angle... I've gone ahead and opened a separate issue in the end.jmmaljaars commentedon Dec 7, 2020
The
precisionremained unused in case theformatvariable evaluated to the default value. #11145 should fix this. Please note, however, that the "general format"gis used rather than the "floating point format"f! So once #11145 is merged, the snippetreturns
Fix Quantity.to_string() for non-latex format, fixes astropy#11131
Fix Quantity.to_string() for non-latex format, fixes astropy#11131
Fix Quantity.to_string() for non-latex format, fixes astropy#11131
Fix Quantity.to_string() for non-latex format, fixes astropy#11131