floating-point-gui.de icon indicating copy to clipboard operation
floating-point-gui.de copied to clipboard

String comparisons

Open jacobweber opened this issue 13 years ago • 2 comments

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.

jacobweber avatar Apr 08 '11 20:04 jacobweber