[GRASS5] r.in.gdal - precision problem in lib/gis/adj_cellhd.c
blazek at itc.it
Fri Apr 8 03:07:12 EDT 2005
Brad Douglas wrote:
>>>sscanf(cellhd->north, "%.1f", &north);
>>>if (north > 90.0)
>>> return (_("Illegal latitude for North.\n"));
>>It can silently damage data. I am not in favour.
> It should suffice for this specific purpose as a short-term fix.
It does not fix the problem, it just hides it. If we do that, nobody
will fix that in next 10 years.
> Although shunned upon, that usage of sscanf() is littered throughout
> GRASS code. I say we temporarily commit the above to get it "mostly"
> working and work on a permanent solution to non-integer comparisons.
> Maybe we could do one of these:
> /* Compares two floats to 'precision' decimal places */
> /* Returns 1 if equal, 0 otherwise */
> int G_f_equal(float a, float b, int precision)
> /* Compares two floats. "Precision adjusted" */
> /* Returns positive, 0, or negative value if a */
> /* is greater, equal, or less than b */
> float G_relcompare(float a, float b)
But the result will be a map with north > 90 in any case.
If we need a short term solution, I suggest to change the error to
warning or maybe a warning for 90 < north < 90.000x and error for north
More information about the grass-dev