|
From: Hans-Bernhard B. <HBB...@t-...> - 2012-07-07 09:15:12
|
On 07.07.2012 01:45, Simon Garfunkel wrote: > Anyway in my particular situation these "missed approximations" > have a disastrous effect, since I'm creating classes for an hystogram: > > gnuplot> print int(19.1/0.1) > 191 > gnuplot> print int(19.2/0.1) > 191 [...] > Undoubtedly unconvincing classes. That's because you put your class boundaries exactly on those points where you want to check. In effect you're comparing floating-point numbers for exact equality, which is never a good idea. Hence that "hardly ever 1.0" line I quoted earlier. Yes, you could use an offset. But ultimately nothing can really help. Wherever you place your class boundaries, sometimes the inevitable floating-point round-off _will_ move data right across that boundary. |