From 95dc6b406ac63cc1a4393688f792fb567512105d Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 8 Dec 2009 21:16:46 +0100 Subject: Better rounding when Poisson noise is switched off --- src/detector.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/detector.c') diff --git a/src/detector.c b/src/detector.c index 5b12b007..3da5c643 100644 --- a/src/detector.c +++ b/src/detector.c @@ -202,8 +202,10 @@ void record_image(struct image *image, int do_water, int do_poisson, if ( do_poisson ) { counts = poisson_noise(intensity * ph_per_e * sa * DQE); } else { + double rounded; cf = intensity * ph_per_e * sa * DQE; - counts = (int)cf; + rounded = rint(cf); + counts = (int)rounded; } image->hdr[x + image->width*y] = counts; -- cgit v1.2.3