[GRASS-dev] How to: if undefined, set to NULL?

Glynn Clements glynn at gclements.plus.com
Mon Sep 5 08:46:31 PDT 2016


Vaclav Petras wrote:

> > Updated in sandbox, see: https://trac.osgeo.org/grass/changeset/69365
> >
> > Is it though correct?
> >
> 
> I was not looking at the logic but
> 
> if (hue == -1.0) {
> 
> is not safe. Although it will probably work most of the time if you set it
> to the exactly same value (`hue = -1;`),

There's no "probably" about it. If you execute "hue = -1;", a
subsequent "if (hue == -1)" comparison *will* succeed.

Rounding error only occurs when the correct result isn't exactly
representable, which isn't the case here. It doesn't occur randomly.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list