From a90da1791f73b8b9ddcca28e1865c6ae17a78db2 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 19 Nov 2009 14:45:03 +0100 Subject: Tidy up floating-point precision --- src/sfac.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/sfac.c') diff --git a/src/sfac.c b/src/sfac.c index 42aa72ce..ffe98f11 100644 --- a/src/sfac.c +++ b/src/sfac.c @@ -228,7 +228,8 @@ struct molecule *load_molecule() char el[4]; int j, r; int done = 0; - float x, y, z, occ, B; + float xf, yf, zf, occf, Bf; + double x, y, z, occ, B; char *coords; rval = fgets(line, 1023, fh); @@ -248,11 +249,13 @@ struct molecule *load_molecule() } coords = line + 29; - r = sscanf(coords, "%f %f %f %f %f", &x, &y, &z, &occ, &B); + r = sscanf(coords, "%f %f %f %f %f", &xf, &yf, &zf, &occf, &Bf); if ( r != 5 ) { fprintf(stderr, "WTF?\n"); abort(); } + /* Promote to double precision */ + x = xf; y = yf; z = zf; occ = occf; B = Bf; for ( j=0; jn_species; j++ ) { -- cgit v1.2.3