func Float(f float64) float64 {
	if math.IsNaN(f) {
		return 0.0
	}
	if f < 10.0 {
		return mathutil.Round(f, 2)
	}
	return mathutil.Round(f, 1)
}
Float formats float numbers more nicely
package fmtutil
import (
	"fmt"
	"math"
	"strconv"
	"strings"
	"pkg.re/essentialkaos/ek.v12/mathutil"
	"pkg.re/essentialkaos/ek.v12/strutil"
)
const (
	_KILO = 1024
	_MEGA = 1048576
	_GIGA = 1073741824
	_TERA = 1099511627776
)
var OrderSeparator = ","
var SizeSeparator = ""
func PrettyNum(i interface{}, separator ...string) string {
	var str string
	sep := OrderSeparator
	if len(separator) > 0 {
		sep = separator[0]
	}
	switch v := i.(type) {
	case int, int32, int64, uint, uint32, uint64:
		str = fmt.Sprintf("%d", v)
		return appendPrettySymbol(str, sep)
	case float32, float64:
		str = fmt.Sprintf("%.3f", v)
		if str == "NaN" {
			return "0"
		}
		return formatPrettyFloat(str, sep)
	}
	return fmt.Sprintf("%v", i)
}
func PrettyDiff(i int, separator ...string) string {
	if i > 0 {
		return "+" + PrettyNum(i, separator...)
	}
	return PrettyNum(i, separator...)
}
func PrettyPerc(i float64) string {
	i = Float(i)
	if i < 0.01 {
		return "< 0.01%"
	}
	return PrettyNum(i) + "%"
}
func PrettySize(i interface{}, separator ...string) string {
	var f float64
	sep := SizeSeparator
	if len(separator) > 0 {
		sep = separator[0]
	}
	switch u := i.(type) {
	case int:
		f = float64(u)
	case int32:
		f = float64(u)
	case int64:
		f = float64(u)
	case uint:
		f = float64(u)
	case uint32:
		f = float64(u)
	case uint64:
		f = float64(u)
	case float32:
		f = float64(u)
	case float64:
		f = i.(float64)
	}
	if math.IsNaN(f) {
		return "0" + sep + "B"
	}
	switch {
	case f >= _TERA:
		return fmt.Sprintf("%g", Float(f/_TERA)) + sep + "TB"
	case f >= _GIGA:
		return fmt.Sprintf("%g", Float(f/_GIGA)) + sep + "GB"
	case f >= _MEGA:
		return fmt.Sprintf("%g", Float(f/_MEGA)) + sep + "MB"
	case f >= _KILO:
		return fmt.Sprintf("%g", Float(f/_KILO)) + sep + "KB"
	default:
		return fmt.Sprintf("%g", mathutil.Round(f, 0)) + sep + "B"
	}
}
func PrettyBool(b bool, vals ...string) string {
	switch {
	case b && len(vals) >= 1:
		return vals[0]
	case !b && len(vals) >= 2:
		return vals[1]
	case b:
		return "Y"
	}
	return "N"
}
func ParseSize(size string) uint64 {
	ns := strings.ToLower(strings.Replace(size, " ", "", -1))
	mlt, sfx := extractSizeInfo(ns)
	if sfx == "" {
		num, err := strconv.ParseUint(size, 10, 64)
		if err != nil {
			return 0
		}
		return num
	}
	ns = strings.TrimRight(ns, sfx)
	numFlt, err := strconv.ParseFloat(ns, 64)
	if err != nil {
		return 0
	}
	return uint64(numFlt * float64(mlt))
}