commit 742359317f9897041422dd1254495596731f45e9
parent 04fb87e1b1b0eada8c80f840cefe7b4186b88052
Author: Wilson Gheen <wilson@wilsonrgheen.com>
Date: Mon, 16 Jan 2023 08:19:01 -0600
Compare with FLT_EPSILON to determine if float is zero
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/photomosaics.c b/photomosaics.c
@@ -347,7 +347,7 @@ static unsigned char *get_img_with_closest_avg(char *img_list, size_t img_list_s
if(fetched_avg_from_cache)
assert(get_resized_pixel_info(&img_list[c], width, height, pixels, exception));
// For now, return any perfect match
- if(new_distance < 0.01f) {
+ if(new_distance < FLT_EPSILON) {
free(pixels_of_closest);
return pixels;
}
@@ -405,7 +405,7 @@ void usage(char *progname) {
"of 'input_file' of size 'width' x 'length' by the resized\n\t"
"version of some image with a similar average color.\n\t"
"Writes the new image to the filename specified by 'output_file'.\n"
- "\n\nExit status:\n"
+ "\nExit status:\n"
"\t0\tSpecified operation succeeded\n"
"\t1\tError reading or performing some operation on an image\n"
"\t2\tError parsing command line arguments\n"