Swap order of nan checks to allow histogram(:middle) to work with zero stdev arrays

The check would set it to 1 if nbins was <= 0, and then try to check 1.nan? which failed because 1 is a Fixnum (not a float). Swapping the order fixes this.