Hackers,
PostGIS spotted that picksplit algorithm freezes in infinite loop when dealing with nan values. I discovered same bug is present in core opclasses. Attached patch fixes this issue interpreting nan as value greater than infinity like btree comparison function does.
This patch contain copy of float8_cmp_internal rather than exposing it from float.c, because it let compiler inline this function.
------
With best regards,
Alexander Korotkov.