Here a patch that fixes NumericRangeQuery to correctly handle NaN. If the upper/lower bounds == null, it will replace that by infinity and will never match NaN (this was a bug before). If you want to hit NaN with NRQ, you can do that only by directly hitting it using NumericRangeQuery.newFloatRange("float", Float.NaN, Float.NaN, true, true)
This patch also handles doubles in addition to floats and uses the native Java method without raw. Tests were modified to check for NaN, too.
The use of floatToIntBits instead of floatToRawIntBits has no real performance impact, as this method is only used during indexing. Population of FieldCache is unaffected. It just ensures that indexes are built with normalized NaN values, so NRQ can work correctly.
Stored fields were already stored using the non-raw method, so this is now consistent.