Trying to threshold compare floats; Is there a standard extension for this?
l
louiscad
07/17/2020, 12:05 PM
I don't think so. You want to set a precision and have 0.996 and 1.014 be treated as equals if the precision is 0.01 ?
a
allan.conda
07/17/2020, 6:12 PM
Yep. It’s simple to do manually but Kotlin keeps surprising me with hidden extension functions 😄. Though checked around there’s probably not one.
I know Guava has fuzzyEquals for example.