floating-point-gui.de
floating-point-gui.de copied to clipboard
String comparisons
I love this guide -- I'm going to send it to the rest of my development team. One thing I think is missing is some information on comparing floats by converting them to strings. This is often the easiest way to test for equality, when you're only concerned with how the numbers will be displayed. You can just format both numbers to the number of decimal places that you'll be displaying (e.g. using sprintf), and compare the strings.