diff options
author | Thomas White <taw@physics.org> | 2011-02-03 10:21:11 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:12 +0100 |
commit | a00ff7c5f18b20ccc2a8f2ba4469e9d54e387c5c (patch) | |
tree | 6936db28ba5dcd6746292b2c01c1df5cc79ca3df /src/hrs-scaling.c | |
parent | 2d115d0b42969bfec1d921ac2895efb3d87bc6ae (diff) |
Don't use 0.0 / 0.0 = NaN
Diffstat (limited to 'src/hrs-scaling.c')
-rw-r--r-- | src/hrs-scaling.c | 7 |
1 files changed, 5 insertions, 2 deletions
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; h<n_ref; h++ ) { - double vc, Ih, uh, rha, vha, uha; + double vc, Ih, uh, vh, rha, vha, uha; struct refl_item *it = get_item(obs, h); const signed int h = it->h; 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; |