From ea43e312e470504f65b17cd03ad7e6356590f804 Mon Sep 17 00:00:00 2001 From: Steven Robertson Date: Sun, 18 Mar 2012 14:58:25 -0700 Subject: [PATCH] Avoid overflow in exponential var. --- cuburn/code/variations.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cuburn/code/variations.py b/cuburn/code/variations.py index abb70e3..bdd5d40 100644 --- a/cuburn/code/variations.py +++ b/cuburn/code/variations.py @@ -172,9 +172,11 @@ var(17, 'popcorn', """ var(18, 'exponential', """ float dx = w * expf(tx - 1.0f); - float dy = M_PI * ty; - ox += dx * cosf(dy); - oy += dx * sinf(dy); + if (isfinite(dx)) { + float dy = M_PI * ty; + ox += dx * cosf(dy); + oy += dx * sinf(dy); + } """) var(19, 'power', """