title: How to do a binary search on a Vec of floats?
body: <p>If you have a <code>Vec&lt;u32&gt;</code> you would use the <a href="http://doc.rust-lang.org/std/primitive.slice.html#method.binary_search" rel="noreferrer"><code>slice::binary_search</code></a> method.</p>
  
  <p>For reasons I don't understand, <code>f32</code> and <code>f64</code> do not implement <code>Ord</code>. Since the primitive types are from the standard library, you cannot implement <code>Ord</code> on them yourself, so it does not appear you can use this method.</p>
  
  <p>How can you effectively do this? </p>
  
  <p>Do I really have to wrap <code>f64</code> in a wrapper struct and implement <code>Ord</code> on it? It seems extremely painful to have to do this, and involves a great deal of <code>transmute</code> to cast blocks of data back and forth unsafely for effectively no reason.</p>