tuple to numpy, data accuracy

When I convert tuple to numpy,there is a problem of data accuracy.Code like this: import numpy as np a=(0.547693688614422, -0.7854270889025808, 0.6267478456110592) print(a) print(type(a)) tmp=np.array(a) print(tmp) The result like this: (0.547693688614422, -0.7854270889025808, 0.6267478456110592) <class ‘tuple’> [ 0.54769369 -0.78542709 0.62674785] please help. >Solution : One way is to set this: In [1039]: np.set_printoptions(precision=20) In [1041]: tmp=np.array(a) In… Read More tuple to numpy, data accuracy

For a given precision, what is the maximum value for which a float32 will give the same result as a float64?

With numpy, I’m trying to understand what is the maximum value that can be downcasted from float64 to float32 with a loss on accuracy less or equal to 0.001. Since I could not find a simple explanation online, I quickly came up with this piece of code to test : result = {} for j… Read More For a given precision, what is the maximum value for which a float32 will give the same result as a float64?