2 ms·
This case looks okay. It's converting a double to an int64_t and then back to double for comparison. It doesn't really suffer from the typical reason why floati
by kccqzy 2y ago
This case looks okay. It's converting a double to an int64_t and then back to double for comparison. It doesn't really suffer from the typical reason why floating point comparison is frowned upon, such as catastrophic cancellation.
I've once optimized a function to be faster, and in a unit test asserted that the old slower version gives exactly the same floating point answer as the new optimized version. It's doable in some cases.