I had a fun floating-point related bug the other day: I wanted to sort a list of doubles in C, and my comparison function was in essence:
static int compare (void *dpa, void *dpb)
{
return *(double*)dpa - *(double*)dpb;
}
The doubles represented times in nanoseconds, and the program failed to sort properly when the total runtime was larger than (IIRC) 2 seconds. I wonder if you can work out why.(Spoiler alert) the fix was: https://github.com/libguestfs/libguestfs/commit/1f4a0bd90df3...