[Gdal-dev] OGR returns wrong floating values for shapefiles (and integer as real, in error)

Frank Warmerdam warmerdam at pobox.com
Wed Oct 25 10:07:05 EDT 2006


Maciej Sieczka wrote:
> What about the other issue - could OGR output the
> 
> Z_BREACH (Real) =      101.583309999999997
> 
> as
> 
> Z_BREACH (Real) =      101.58331
> 
> instead?
> 
> I don't think it is just me accustomed to the latter form. It is more
> human readable and shorter, cleaner. Users would like it I believe.

Maciek,

The "fuzzy" form of the number apparently reflects a fuzzy form of the
number stored in the file.  Generally I try to report up to "near" double
precision when giving textual output.  I am hesitant to alter ogrinfo
in this regard, even though the numbers are ugly.

Ogrinfo is, amoung other things, a debugging tool, and having it report
quite closely the underlying values can be valuable.

Of course, other OGR applications can choose how they want to report
the numbers.

In short, I'm not inclined to make any change in this regard.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list