From ac7f70a9bb662cecf731cab5457936ed83d30961 Mon Sep 17 00:00:00 2001 From: Antonio Valentino Date: Mon, 1 Feb 2016 23:48:59 +0100 Subject: [PATCH] Fix floating point trunation in mod function (closes gh-3) --- pixelfunctions.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pixelfunctions.c b/pixelfunctions.c index 79801ca51468..81396834b1e8 100644 --- a/pixelfunctions.c +++ b/pixelfunctions.c @@ -171,7 +171,7 @@ CPLErr ModulePixelFunc(void **papoSources, int nSources, void *pData, for( iCol = 0; iCol < nXSize; ++iCol, ++ii ) { /* Source raster pixels may be obtained with SRCVAL macro */ - dfPixVal = abs(SRCVAL(papoSources[0], eSrcType, ii)); + dfPixVal = fabs(SRCVAL(papoSources[0], eSrcType, ii)); GDALCopyWords(&dfPixVal, GDT_Float64, 0, ((GByte *)pData) + nLineSpace * iLine + @@ -725,7 +725,7 @@ CPLErr Log10PixelFunc(void **papoSources, int nSources, void *pData, /* Source raster pixels may be obtained with SRCVAL macro */ dfPixVal = SRCVAL(papoSources[0], eSrcType, ii); - dfPixVal = log10( abs( dfPixVal ) ); + dfPixVal = log10( fabs( dfPixVal ) ); GDALCopyWords(&dfPixVal, GDT_Float64, 0, ((GByte *)pData) + nLineSpace * iLine +