I'm currently trying to round standard deviations to the sixth decimal place from an array of data.
Python round() didn't work as I wanted it to, given that some numbers were displayed oddly. For example, what I meant to be 0.013931 showed up as 0.013931099999999998. I fixed the gist of the issue by using Decimal and setting the context precision to 5, but now some standard deviations show up rounded to the 6th decimal while others are rounded to the 7th!
from decimal import *
getcontext().prec = 4
getcontext().rounding = ROUND_HALF_UP
print(Decimal(0.005855795678472189)/10)
print(Decimal(0.013931099999999998)/10)
I expect the output to be 0.00058558 and 0.0013931, yet the actual output is 0.0005856 and 0.001393, which have different lengths!