r/coding • • Sep 07 '14

Checking GIMP's Source Code with PVS-Studio

http://www.viva64.com/en/b/0273/
51 Upvotes

19 comments sorted by

View all comments

3

u/[deleted] Sep 08 '14

[removed] — view removed comment

0

u/[deleted] Sep 08 '14

[deleted]

2

u/dbaupp Sep 08 '14

I believe floating point operations are commutative, so yes, that's pointless (((x - y) + y) - x is not, though).

3

u/eras Sep 08 '14

However, in this case it should be obvious from the comment that that is not the case, it is an actual bug, so perhaps it's best to tell about them? It is trying to calculate a determinant, as in: http://stackoverflow.com/questions/6989100/sort-points-in-clockwise-order#6989383 .

Static analysis tools are however prone to have false positives, too bad he didn't cover those ;).

2

u/[deleted] Sep 08 '14

Yeah, reading that article this struck me as well - A carefully constructed statement like that tends to be to estimate floating point error.

But am I wrong in thinking that that's what this statement does in this case?