Relative Content

Tag Archive for cfloating-pointfloating-accuracyepsilon

How can I solve Float type Machine Epsilon Calculation Error?

#include <stdio.h> void get_eps(float *eps) { *eps = 1.0f; while ((1.0f + *eps / 2.0f) != 1.0f) { *eps /= 2.0f; } } int main(){ float eps; get_eps(&eps); printf(“Machine Accuracy (get_eps): t%.10gn”, eps); return 0; } I am trying to calculate the machine epsilon of float(32bit). Expecting 1.19e-07, which is the known machine epsilon for […]