[GRASS-dev] [GRASS GIS] #2854: results in winGRASS7 32bit vs 64bit: should they be identical?

GRASS GIS trac at osgeo.org
Tue Mar 1 06:29:29 PST 2016

#2854: results in winGRASS7 32bit vs 64bit: should they be identical?
  Reporter:  hellik  |      Owner:  grass-dev@…
      Type:  defect  |     Status:  new
  Priority:  normal  |  Milestone:  7.0.4
 Component:  Raster  |    Version:  svn-releasebranch70
Resolution:          |   Keywords:
       CPU:  x86-64  |   Platform:  MSWindows 7

Comment (by glynn):

 Replying to [comment:12 mmetz]:

 > The results are thus as precise as requested per GCC compiler options
 for the given architecture. The same GCC compiler options can lead to
 different results under different architectures.

 There should be some set of options which produce the correct result on
 any architecture which uses IEEE-754.

 > Generally, with limited fp precision,
 > (a * b) / c != a * (b / c)

 This shouldn't be relevant. The source code won't change between
 architectures, and gcc shouldn't perform such approximations unless
 specifically requested via -ffast-math or similar (apparently -Ofast
 enables this, but none of the numbered optimisation levels do).

 The main issue which occurs with the default options is excess precision.
 The x87 FPU uses 80 bits by default; you need to use e.g. -ffloat-store or
 -fexcess-precision=standard to force the result to be rounded to 64 bits.
 SSE always rounds to 64 bits.

 > In other words, the results obtained with WinGRASS 32bit and WinGRASS
 64bit are both correct, even if they differ from each other. The results
 are as precise as possible / as requested.

 The issue is how you test for correctness. You can either build for
 deterministic calculation so that exact equality comparisons will work, or
 you can use a tolerance. The latter option requires case-by-case analysis
 (see point 4 in comment:9).

Ticket URL: <https://trac.osgeo.org/grass/ticket/2854#comment:14>
GRASS GIS <https://grass.osgeo.org>

More information about the grass-dev mailing list