Skip to content

Commit

Permalink
Typecast from int to double.
Browse files Browse the repository at this point in the history
  • Loading branch information
octalmage committed Jul 25, 2015
1 parent fbd3be0 commit 8730e94
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/rgb.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ H_INLINE int MMRGBColorSimilarToColor(MMRGBColor c1, MMRGBColor c2,
uint8_t d1 = c1.red - c2.red;
uint8_t d2 = c1.green - c2.green;
uint8_t d3 = c1.blue - c2.blue;
/*return sqrt((d1 * d1) +
return sqrt((double)(d1 * d1) +
(d2 * d2) +
(d3 * d3)) <= (tolerance * 442.0f);*/
(d3 * d3)) <= (tolerance * 442.0f);
}

}
Expand All @@ -94,9 +94,9 @@ H_INLINE int MMRGBHexSimilarToColor(MMRGBHex h1, MMRGBHex h2, float tolerance)
uint8_t d1 = RED_FROM_HEX(h1) - RED_FROM_HEX(h2);
uint8_t d2 = GREEN_FROM_HEX(h1) - GREEN_FROM_HEX(h2);
uint8_t d3 = BLUE_FROM_HEX(h1) - BLUE_FROM_HEX(h2);
/*return sqrt((d1 * d1) +
return sqrt((double)(d1 * d1) +
(d2 * d2) +
(d3 * d3)) <= (tolerance * 442.0f);*/
(d3 * d3)) <= (tolerance * 442.0f);
}
}

Expand Down

0 comments on commit 8730e94

Please sign in to comment.