Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the minimum or maximum value of an iterator containing floating point numbers?

Tags:

I understand why the floats don't have an implementation for Ord but that doesn't particularly help me when I want to be lazy and use iterators.

Is there a workaround or an easy way to take the minimum / min / min_by of an iterator containing floating point numbers?

I know one can sort (which is slow) or wrap it in another type and implement the needed trades (which is verbose) but I am hoping for something a little more elegant.