From a00ff7c5f18b20ccc2a8f2ba4469e9d54e387c5c Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 3 Feb 2011 10:21:11 +0100 Subject: Don't use 0.0 / 0.0 = NaN --- src/hrs-scaling.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/hrs-scaling.c') diff --git a/src/hrs-scaling.c b/src/hrs-scaling.c index 928da4a7..86a40fb1 100644 --- a/src/hrs-scaling.c +++ b/src/hrs-scaling.c @@ -178,7 +178,7 @@ static double iterate_scale(struct image *images, int n, for ( h=0; hh; const signed int k = it->k; @@ -188,7 +188,9 @@ static double iterate_scale(struct image *images, int n, vha = s_vha(h, k, l, images, n, sym, a); uha = s_uha(h, k, l, images, n, sym, a); uh = s_uh(images, n, h, k, l, sym); - Ih = s_vh(images, n, h, k, l, sym) / uh; + vh = s_vh(images, n, h, k, l, sym); + Ih = vh / uh; + if ( isnan(Ih) ) Ih = 0.0; /* 0 / 0 = 0, not NaN */ rha = vha - image_a->osf * uha * Ih; vc = Ih * rha; vc_tot += vc; @@ -208,6 +210,7 @@ static double iterate_scale(struct image *images, int n, rhb = vhb - image_b->osf * uhb * Ih; mc = (rha*vhb + vha*rhb - vha*vhb) / uh; + if ( isnan(mc) ) mc = 0.0; /* 0 / 0 = 0 */ if ( a == b ) { mc += pow(Ih, 2.0) * uha; -- cgit v1.2.3