package util

// AbsMinusd returns the value, with the absolute value subtracted
// by minus, or 0 if minus is more than abs.
func AbsMinusd(val, minus float64) float64 {
	if val > 0 {
		val -= minus
		if val < 0 {
			val = 0
		}
	} else {
		val += minus
		if val > 0 {
			val = 0
		}
	}
	return val
}
