?

Average Error: 0.0 → 0.0
Time: 5.6s
Precision: binary64
Cost: 576

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0.0
Herbie0.0
\[a \cdot b + a \cdot \left(c + d\right) \]

Derivation?

  1. Initial program 0.0

    \[a \cdot \left(\left(b + c\right) + d\right) \]
  2. Taylor expanded in c around 0 0.0

    \[\leadsto \color{blue}{\left(d + b\right) \cdot a + c \cdot a} \]
  3. Final simplification0.0

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

Alternatives

Alternative 1
Error30.8
Cost1249
\[\begin{array}{l} \mathbf{if}\;d \leq 1.35 \cdot 10^{-285}:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;d \leq 1.25 \cdot 10^{-256}:\\ \;\;\;\;a \cdot c\\ \mathbf{elif}\;d \leq 2.05 \cdot 10^{-168}:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;d \leq 3.9 \cdot 10^{-157}:\\ \;\;\;\;a \cdot c\\ \mathbf{elif}\;d \leq 1.56 \cdot 10^{-145}:\\ \;\;\;\;b \cdot a\\ \mathbf{elif}\;d \leq 7.8 \cdot 10^{-115} \lor \neg \left(d \leq 2.9 \cdot 10^{-97}\right) \land d \leq 9.5 \cdot 10^{-87}:\\ \;\;\;\;a \cdot c\\ \mathbf{else}:\\ \;\;\;\;d \cdot a\\ \end{array} \]
Alternative 2
Error10.2
Cost1112
\[\begin{array}{l} t_0 := a \cdot \left(d + c\right)\\ t_1 := a \cdot \left(b + c\right)\\ t_2 := \left(d + b\right) \cdot a\\ \mathbf{if}\;d \leq 4.4 \cdot 10^{-138}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d \leq 5.2 \cdot 10^{-124}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 8.5 \cdot 10^{-112}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d \leq 4.8 \cdot 10^{-97}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;d \leq 6.2 \cdot 10^{-87}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d \leq 1.36 \cdot 10^{-32}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error13.4
Cost717
\[\begin{array}{l} \mathbf{if}\;d \leq 3.9 \cdot 10^{-112} \lor \neg \left(d \leq 5 \cdot 10^{-97}\right) \land d \leq 4.5 \cdot 10^{-75}:\\ \;\;\;\;a \cdot \left(b + c\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot a\\ \end{array} \]
Alternative 4
Error0.0
Cost576
\[a \cdot \left(d + c\right) + b \cdot a \]
Alternative 5
Error9.6
Cost452
\[\begin{array}{l} \mathbf{if}\;d \leq 2.3 \cdot 10^{-138}:\\ \;\;\;\;a \cdot \left(b + c\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(d + c\right)\\ \end{array} \]
Alternative 6
Error0.0
Cost448
\[a \cdot \left(d + \left(b + c\right)\right) \]
Alternative 7
Error29.1
Cost324
\[\begin{array}{l} \mathbf{if}\;b \leq 1.95 \cdot 10^{-123}:\\ \;\;\;\;a \cdot c\\ \mathbf{else}:\\ \;\;\;\;b \cdot a\\ \end{array} \]
Alternative 8
Error40.4
Cost192
\[b \cdot a \]

Error

Reproduce?

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