GDAL
August 16, 2009, 8:55am
1
#720: G_trim_decimal(): don't chop 0s on strings ending in e+20
----------------------------+-----------------------------------------------
Reporter: hamish | Owner: grass-dev@lists.osgeo.org
Type: defect | Status: new
Priority: critical | Milestone: 6.4.0
Component: libgis | Version: 6.4.0 RCs
Keywords: G_trim_decimal | Platform: All
Cpu: All |
----------------------------+-----------------------------------------------
Hi,
G_trim_decimal() will blindly chop away 0s after the decimal point,
converting ,for example, a string ending in e+20 into e+2.
I guess 'e' needs to be the trigger character; if found we have a choice
to either just return the original string or perform heroics
such as:
{{{
1.234567890123460000000000000000e+20
->
1.23456789012346e+20
}}}
?
thanks,
Hamish
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/720> ;
GRASS GIS <http://grass.osgeo.org >
GDAL
August 20, 2009, 11:25am
2
#720: G_trim_decimal(): don't chop 0s on strings ending in e+20
-----------------------+----------------------------------------------------
Reporter: hamish | Owner: grass-dev@lists.osgeo.org
Type: defect | Status: new
Priority: critical | Milestone: 6.4.0
Component: libgis | Version: 6.4.0 RCs
Resolution: | Keywords: G_trim_decimal
Platform: All | Cpu: All
-----------------------+----------------------------------------------------
Comment (by hamish):
comments?
{{{
Index: lib/gis/trim_dec.c
--- lib/gis/trim_dec.c (revision 38754)
+++ lib/gis/trim_dec.c (working copy)
@@ -14,6 +14,7 @@
* \date 1999-2008
*/
+#include <string.h>
#include <grass/gis.h>
@@ -30,6 +31,10 @@
{
char *mark;
+ /* don't trim e+20 into e+2 */
+ if( strchr(buf, 'e') || strchr(buf, 'E') )
+ return 0;
+
/* find the . */
while (*buf != '.')
if (*buf++ == 0)
}}}
Hamish
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/720#comment:1> ;
GRASS GIS <http://grass.osgeo.org >
GDAL
August 25, 2009, 7:52am
3
#720: G_trim_decimal(): don't chop 0s on strings ending in e+20
-----------------------+----------------------------------------------------
Reporter: hamish | Owner: grass-dev@lists.osgeo.org
Type: defect | Status: new
Priority: critical | Milestone: 6.4.0
Component: libgis | Version: 6.4.0 RCs
Resolution: | Keywords: G_trim_decimal
Platform: All | Cpu: All
-----------------------+----------------------------------------------------
Comment (by hamish):
there has been no feedback so I have applied this patch in 6.5svn and
trunk. I'd like to backport it to 6.4 as well but won't without further
testing.
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/720#comment:2> ;
GRASS GIS <http://grass.osgeo.org >
GDAL
September 6, 2009, 3:17pm
4
#720: G_trim_decimal(): don't chop 0s on strings ending in e+20
-----------------------+----------------------------------------------------
Reporter: hamish | Owner: grass-dev@lists.osgeo.org
Type: defect | Status: closed
Priority: critical | Milestone: 6.4.0
Component: libgis | Version: 6.4.0 RCs
Resolution: fixed | Keywords: G_trim_decimal
Platform: All | Cpu: All
-----------------------+----------------------------------------------------
Changes (by hamish):
* status: new => closed
* resolution: => fixed
Comment:
backported to relbr64 in r39045. still no feedback, hope there are no
problems with it.
Hamish
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/720#comment:3> ;
GRASS GIS <http://grass.osgeo.org >