summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-math/src/math.c
diff options
context:
space:
mode:
Diffstat (limited to 'mrbgems/mruby-math/src/math.c')
-rw-r--r--mrbgems/mruby-math/src/math.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/mrbgems/mruby-math/src/math.c b/mrbgems/mruby-math/src/math.c
index 39fed6cd3..ef0dc1857 100644
--- a/mrbgems/mruby-math/src/math.c
+++ b/mrbgems/mruby-math/src/math.c
@@ -120,6 +120,7 @@ erf(double x)
term *= xsqr/j;
sum += term/(2*j+1);
++j;
+ if (sum == 0) break;
} while (fabs(term/sum) > DBL_EPSILON);
return two_sqrtpi*sum;
}