?

Average Accuracy: 99.9% → 99.9%
Time: 7.3s
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(\left(b + c\right) + d\right) \]
(FPCore (a b c d) :precision binary64 (* a (+ (+ b c) d)))
(FPCore (a b c d) :precision binary64 (* a (+ (+ b c) d)))
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 * ((b + c) + d);
}
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 * ((b + c) + d)
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 * ((b + c) + d);
}
def code(a, b, c, d):
	return a * ((b + c) + d)
def code(a, b, c, d):
	return a * ((b + c) + d)
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(Float64(b + c) + d))
end
function tmp = code(a, b, c, d)
	tmp = a * ((b + c) + d);
end
function tmp = code(a, b, c, d)
	tmp = a * ((b + c) + d);
end
code[a_, b_, c_, d_] := N[(a * N[(N[(b + c), $MachinePrecision] + d), $MachinePrecision]), $MachinePrecision]
code[a_, b_, c_, d_] := N[(a * N[(N[(b + c), $MachinePrecision] + d), $MachinePrecision]), $MachinePrecision]
a \cdot \left(\left(b + c\right) + d\right)
a \cdot \left(\left(b + c\right) + d\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(\left(b + c\right) + d\right) \]

Alternatives

Alternative 1
Accuracy50.3%
Cost1513
\[\begin{array}{l} \mathbf{if}\;d \leq 4.4 \cdot 10^{-292}:\\ \;\;\;\;a \cdot c\\ \mathbf{elif}\;d \leq 1.72 \cdot 10^{-279}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;d \leq 3 \cdot 10^{-252}:\\ \;\;\;\;a \cdot c\\ \mathbf{elif}\;d \leq 3 \cdot 10^{-154}:\\ \;\;\;\;a \cdot b\\ \mathbf{elif}\;d \leq 3.6 \cdot 10^{-113}:\\ \;\;\;\;a \cdot c\\ \mathbf{elif}\;d \leq 1.8 \cdot 10^{-102}:\\ \;\;\;\;a \cdot d\\ \mathbf{elif}\;d \leq 9 \cdot 10^{-97}:\\ \;\;\;\;a \cdot c\\ \mathbf{elif}\;d \leq 5 \cdot 10^{-92} \lor \neg \left(d \leq 9.5 \cdot 10^{-60}\right) \land d \leq 5.8 \cdot 10^{-50}:\\ \;\;\;\;a \cdot b\\ \mathbf{else}:\\ \;\;\;\;a \cdot d\\ \end{array} \]
Alternative 2
Accuracy77.8%
Cost717
\[\begin{array}{l} \mathbf{if}\;d \leq 6.4 \cdot 10^{-89} \lor \neg \left(d \leq 9.2 \cdot 10^{-60}\right) \land d \leq 6.5 \cdot 10^{-50}:\\ \;\;\;\;a \cdot \left(b + c\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot d\\ \end{array} \]
Alternative 3
Accuracy83.2%
Cost717
\[\begin{array}{l} \mathbf{if}\;d \leq 2.2 \cdot 10^{-124} \lor \neg \left(d \leq 9.5 \cdot 10^{-60}\right) \land d \leq 5.8 \cdot 10^{-50}:\\ \;\;\;\;a \cdot \left(b + c\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(c + d\right)\\ \end{array} \]
Alternative 4
Accuracy52.9%
Cost589
\[\begin{array}{l} \mathbf{if}\;b \leq 6.6 \cdot 10^{-153} \lor \neg \left(b \leq 2 \cdot 10^{-123}\right) \land b \leq 4.7 \cdot 10^{-116}:\\ \;\;\;\;a \cdot c\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
Alternative 5
Accuracy85.2%
Cost584
\[\begin{array}{l} \mathbf{if}\;b \leq 1.38 \cdot 10^{-151}:\\ \;\;\;\;a \cdot \left(c + d\right)\\ \mathbf{elif}\;b \leq 5.8 \cdot 10^{-78}:\\ \;\;\;\;a \cdot \left(b + c\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(b + d\right)\\ \end{array} \]
Alternative 6
Accuracy36.2%
Cost192
\[a \cdot b \]

Error

Reproduce?

herbie shell --seed 2023140 
(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)))