Skip to content

Commit

Permalink
square first then multiply by float so square is done on fully precis…
Browse files Browse the repository at this point in the history
…e ints
  • Loading branch information
FRex committed Feb 22, 2022
1 parent 9064b89 commit dafbdbd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion analyzepng.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ static float RGBtoBrightness(const unsigned char * rgb)
const float r = rgb[0];
const float g = rgb[1];
const float b = rgb[2];
return sqrt(0.299 * r * r + 0.587 * g * g + 0.114 * b * b);
return sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b));
}

static int compareRGB(const void * a, const void * b)
Expand Down

0 comments on commit dafbdbd

Please sign in to comment.