func floatFlip(x uint32) uint32 {
	if (x & 0x80000000) == 0x80000000 {
		return x ^ 0xFFFFFFFF
	}
	return x ^ 0x80000000
}
Converts a uint32 that represents a true float to one that sorts properly
package zfloat32
import (
	"math"
	"sort"
)
const (
	MinSize      = 256
	radix   uint = 8
	bitSize uint = 32
)
func Sort(x []float32) {
	if len(x) < MinSize {
		sort.Slice(x, func(i, j int) bool { return x[i] < x[j] })
	} else {
		SortBYOB(x, make([]float32, len(x)))
	}
}
func SortCopy(x []float32) []float32 {
	y := make([]float32, len(x))
	copy(y, x)
	Sort(y)
	return y
}
func SortBYOB(x, buffer []float32) {
	if len(x) > len(buffer) {
		panic("Buffer too small")
	}
	if len(x) < 2 {
		return
	}
	nans := 0
	for idx, val := range x {
		if math.IsNaN(float64(val)) {
			x[idx] = x[nans]
			x[nans] = val
			nans++
		}
	}
	from := x[nans:]
	to := buffer[:len(from)]
	var key uint8
	var uintVal uint32
	for keyOffset := uint(0); keyOffset < bitSize; keyOffset += radix {
		var offset [256]int  
		sorted := true       
		prev := float32(0)   
		for _, val := range from {
			uintVal = floatFlip(math.Float32bits(val))
			key = uint8(uintVal >> keyOffset)  
			offset[key]++                      
			if sorted {  
				sorted = val >= prev
				prev = val
			}
		}
		if sorted {  
			if (keyOffset/radix)%2 == 1 {
				copy(to, from)
			}
			return
		}
		watermark := 0
		for i, count := range offset {
			offset[i] = watermark
			watermark += count
		}
		for _, val := range from {
			uintVal = floatFlip(math.Float32bits(val))
			key = uint8(uintVal >> keyOffset)  
			to[offset[key]] = val              
			offset[key]++                      
		}
		from, to = to, from
	}
}