?

Average Accuracy: 99.9% → 99.9%
Time: 7.7s
Precision: binary64
Cost: 448

?

\[\left(\left(\left(56789 \leq a \land a \leq 98765\right) \land \left(0 \leq b \land b \leq 1\right)\right) \land \left(0 \leq c \land c \leq 0.0016773\right)\right) \land \left(0 \leq d \land d \leq 0.0016773\right)\]
\[a \cdot \left(\left(b + c\right) + d\right) \]
\[a \cdot \left(d + \left(b + c\right)\right) \]
(FPCore (a b c d) :precision binary64 (* a (+ (+ b c) d)))
(FPCore (a b c d) :precision binary64 (* a (+ d (+ b c))))
double code(double a, double b, double c, double d) {
	return a * ((b + c) + d);
}
double code(double a, double b, double c, double d) {
	return a * (d + (b + c));
}
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    code = a * ((b + c) + d)
end function
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    code = a * (d + (b + c))
end function
public static double code(double a, double b, double c, double d) {
	return a * ((b + c) + d);
}
public static double code(double a, double b, double c, double d) {
	return a * (d + (b + c));
}
def code(a, b, c, d):
	return a * ((b + c) + d)
def code(a, b, c, d):
	return a * (d + (b + c))
function code(a, b, c, d)
	return Float64(a * Float64(Float64(b + c) + d))
end
function code(a, b, c, d)
	return Float64(a * Float64(d + Float64(b + c)))
end
function tmp = code(a, b, c, d)
	tmp = a * ((b + c) + d);
end
function tmp = code(a, b, c, d)
	tmp = a * (d + (b + c));
end
code[a_, b_, c_, d_] := N[(a * N[(N[(b + c), $MachinePrecision] + d), $MachinePrecision]), $MachinePrecision]
code[a_, b_, c_, d_] := N[(a * N[(d + N[(b + c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
a \cdot \left(\left(b + c\right) + d\right)
a \cdot \left(d + \left(b + c\right)\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original99.9%
Target99.9%
Herbie99.9%
\[a \cdot b + a \cdot \left(c + d\right) \]

Derivation?

  1. Initial program 99.9%

    \[a \cdot \left(\left(b + c\right) + d\right) \]
  2. Final simplification99.9%

    \[\leadsto a \cdot \left(d + \left(b + c\right)\right) \]

Alternatives

Alternative 1
Accuracy52.5%
Cost852
\[\begin{array}{l} \mathbf{if}\;c \leq 8.5 \cdot 10^{-229}:\\ \;\;\;\;a \cdot d\\ \mathbf{elif}\;c \leq 3.5 \cdot 10^{-210}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \leq 7 \cdot 10^{-199}:\\ \;\;\;\;a \cdot d\\ \mathbf{elif}\;c \leq 2.4 \cdot 10^{-189}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;c \leq 9.5 \cdot 10^{-111}:\\ \;\;\;\;a \cdot d\\ \mathbf{else}:\\ \;\;\;\;a \cdot c\\ \end{array} \]
Alternative 2
Accuracy85.0%
Cost848
\[\begin{array}{l} t_0 := a \cdot \left(c + d\right)\\ t_1 := a \cdot \left(b + d\right)\\ \mathbf{if}\;c \leq 9.5 \cdot 10^{-140}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 2.1 \cdot 10^{-115}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 1.02 \cdot 10^{-110}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 1.65 \cdot 10^{-102}:\\ \;\;\;\;a \cdot \left(b + c\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Accuracy79.0%
Cost717
\[\begin{array}{l} \mathbf{if}\;d \leq 2.9 \cdot 10^{-124} \lor \neg \left(d \leq 1.85 \cdot 10^{-112}\right) \land d \leq 2.7 \cdot 10^{-82}:\\ \;\;\;\;a \cdot \left(b + c\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot d\\ \end{array} \]
Alternative 4
Accuracy82.7%
Cost452
\[\begin{array}{l} \mathbf{if}\;b \leq 1.9 \cdot 10^{-81}:\\ \;\;\;\;a \cdot \left(c + d\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(b + c\right)\\ \end{array} \]
Alternative 5
Accuracy53.4%
Cost324
\[\begin{array}{l} \mathbf{if}\;c \leq 2.7 \cdot 10^{-134}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;a \cdot c\\ \end{array} \]
Alternative 6
Accuracy36.0%
Cost192
\[a \cdot b \]

Error

Reproduce?

herbie shell --seed 2023137 
(FPCore (a b c d)
  :name "Expression, p14"
  :precision binary64
  :pre (and (and (and (and (<= 56789.0 a) (<= a 98765.0)) (and (<= 0.0 b) (<= b 1.0))) (and (<= 0.0 c) (<= c 0.0016773))) (and (<= 0.0 d) (<= d 0.0016773)))

  :herbie-target
  (+ (* a b) (* a (+ c d)))

  (* a (+ (+ b c) d)))