// calculate func calculate the recommended replicas by given usageRatio and currentReplicas
calculate func calculate the recommended replicas by given usageRatio and currentReplicas
// calculate func calculate the recommended replicas by given usageRatio and currentReplicas
func calculate(currentValue float64, targetValue float64, currentReplicas int32) (int32, error) {
	if almostEqual(targetValue, 0.0) {
		return -1, fmt.Errorf("targetValue in calculate func can't be zero")
	}
	usageRatio := currentValue / targetValue
	return int32(math.Ceil(usageRatio * float64(currentReplicas))), nil
}
func calculate ( currentValue float64 , targetValue float64 , currentReplicas int32 ) ( int32 , error ) { if almostEqual ( targetValue , 0.0 ) { return - 1 , fmt . Errorf ( " " ) } usageRatio := currentValue / targetValue return int32 ( math . Ceil ( usageRatio * float64 ( currentReplicas ) ) ) , nil }
calculate func calculate the recommended replicas by given usageRatio and currentReplicas
calculate func calculate the recommended replicas by given usageRatio and currentReplicas