promql/engine.go
func scalarBinop(op ItemType, lhs, rhs float64) float64 {
	switch op {
	case ItemADD:
		return lhs + rhs
	case ItemSUB:
		return lhs - rhs
	case ItemMUL:
		return lhs * rhs
	case ItemDIV:
		return lhs / rhs
	case ItemPOW:
		return math.Pow(lhs, rhs)
	case ItemMOD:
		return math.Mod(lhs, rhs)
	case ItemEQL:
		return btos(lhs == rhs)
	case ItemNEQ:
		return btos(lhs != rhs)
	case ItemGTR:
		return btos(lhs > rhs)
	case ItemLSS:
		return btos(lhs < rhs)
	case ItemGTE:
		return btos(lhs >= rhs)
	case ItemLTE:
		return btos(lhs <= rhs)
	}
	panic(errors.Errorf("operator %q not allowed for Scalar operations", op))
}
func scalarBinop(op ItemType, lhs, rhs float64) float64 {
	switch op {
	case ItemADD:
		return lhs + rhs
	case ItemSUB:
		return lhs - rhs
	case ItemMUL:
		return lhs * rhs
	case ItemDIV:
		return lhs / rhs
	case ItemPOW:
		return math.Pow(lhs, rhs)
	case ItemMOD:
		return math.Mod(lhs, rhs)
	case ItemEQL:
		return btos(lhs == rhs)
	case ItemNEQ:
		return btos(lhs != rhs)
	case ItemGTR:
		return btos(lhs > rhs)
	case ItemLSS:
		return btos(lhs < rhs)
	case ItemGTE:
		return btos(lhs >= rhs)
	case ItemLTE:
		return btos(lhs <= rhs)
	}
	panic(errors.Errorf("operator %q not allowed for Scalar operations", op))
}
func scalarBinop ( op ItemType , lhs , rhs float64 ) float64 { switch op { case ItemADD : return lhs + rhs case ItemSUB : return lhs - rhs case ItemMUL : return lhs * rhs case ItemDIV : return lhs / rhs case ItemPOW : return math . Pow ( lhs , rhs ) case ItemMOD : return math . Mod ( lhs , rhs ) case ItemEQL : return btos ( lhs == rhs ) case ItemNEQ : return btos ( lhs != rhs ) case ItemGTR : return btos ( lhs > rhs ) case ItemLSS : return btos ( lhs < rhs ) case ItemGTE : return btos ( lhs >= rhs ) case ItemLTE : return btos ( lhs <= rhs ) } panic ( errors . Errorf ( " " , op ) ) }
// scalarBinop evaluates a binary operation between two Scalars.
scalarBinop evaluates a binary operation between two Scalars .