Hi, I have encountered a worrying problem, during migration of software from numarray to numpy, perhaps someone could help me determine how this could be addressed.
I have a large array or values 10000 long 12 items per line. The matrix contains floats, dtype=float32 in numpy and type=Float32 in numarray. When I perform a mean of one of the columns we observe a discrepancies in the output values. numarray: >>> port_result.agg_matrix._array[::,2].mean() 193955925.49500328 numpy: >>> port_result.agg_matrix._array[::,2].mean() 193954536.48896 If we examine a specific line in the matrix the arrays appear identical: numarray: >>> port_result.agg_matrix[0] array([ 2.11549568e+08, 4.03735232e+08, 8.47466400e+07, 3.99625600e+07, 7.99853550e+06, 6.68247100e+06, 0.00000000e+00, 1.00018790e+07, 3.43065200e+07, 1.75261240e+07, 4.89246450e+06, 2.06562788e+06], type=Float32) numpy: >>> port_result.agg_matrix[0] array([ 2.11549568e+08, 4.03735232e+08, 8.47466400e+07, 3.99625600e+07, 7.99853550e+06, 6.68247100e+06, 0.00000000e+00, 1.00018790e+07, 3.43065200e+07, 1.75261240e+07, 4.89246450e+06, 2.06562788e+06], dtype=float32) However when examining a specific item numpy appears to report a value to 8 significant figures regardless of the true value, whereas numarray reported the full value, however if I cast the output as a float the full value is present, just not being output. Could this explain the difference in the mean values? How can I get numpy to always provide the exact value in the array, so behave in the same manner as numarray? numarray: >>> port_result.agg_matrix[0][4] 7998535.5 >>> port_result.agg_matrix[0][11] 2065627.875 numpy: >>> port_result.agg_matrix[0][4] 7998535.5 >>> port_result.agg_matrix[0][11] 2065627.9 >>> float(port_result.agg_matrix[0][4]) 7998535.5 >>> float(port_result.agg_matrix[0][11]) 2065627.875 I appreciate any help anyone can give, thank you. Hanni
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion