I'm trying to understand what machine epsilon is. According to Wikipedia, it can be calculated as follows:
def machineEpsilon(func=float): machine_epsilon = func(1) while func(1)+func(machine_epsilon) != func(1): machine_epsilon_last = machine_epsilon machine_epsilon = func(machine_epsilon) / func(2) return machine_epsilon_last
However, it is only suitable for double precision numbers. I am interested in modifying it to support numbers with one precision. I read that you can use numpy, especially the numpy.float32 class. Can someone help with changing the function?
python numpy epsilon
Bob 02 Oct '13 at 16:03 2013-10-02 16:03
source share