reduce float warnings (comparisons and implicit conversions)
This MR consists of three changes to reduce the number of warnings that would be generated due to floating point concerns:
- It adds new utility functions for performing exact floating point comparisons to 0 and 1. Why the extra function? Because for one, these are the most common types of exact floating point comparisons, and the ones where we usually clearly want exact comparison to happen (e.g. do I need to add this scalar/do I need to multiply with this scalar/can I ignore this term). Furthermore, having this as an extra function means we can hide generating the correctly typed 0 and 1 in their code, and enforce that the correct type is used.
- Replace
==
withequal_strict
in regular code, andVERIFY(... == ...)
withVERIFY_IS_EQUAL
in the tests. - wrote out some implicit conversions into explicit casts. This is only in the test suite.
Q: What should be the name for the comparison to 0/1 numbers? Right now I'm using is_zero_strict
in analogy to equal_strict
, but a more descriptive name (maybe) could also be is_exactly_zero
(this is more how I would read this out aloud in an if, for example).