?

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

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 d around 0 0.0

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

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

Alternatives

Alternative 1
Error30.5
Cost588
\[\begin{array}{l} \mathbf{if}\;b \leq 5.1 \cdot 10^{-253}:\\ \;\;\;\;a \cdot c\\ \mathbf{elif}\;b \leq 5.1 \cdot 10^{-203}:\\ \;\;\;\;a \cdot d\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-151}:\\ \;\;\;\;a \cdot c\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
Alternative 2
Error9.9
Cost584
\[\begin{array}{l} \mathbf{if}\;b \leq 4 \cdot 10^{-151}:\\ \;\;\;\;a \cdot \left(c + d\right)\\ \mathbf{elif}\;b \leq 6.4 \cdot 10^{-119}:\\ \;\;\;\;a \cdot \left(b + d\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(c + b\right)\\ \end{array} \]
Alternative 3
Error12.3
Cost452
\[\begin{array}{l} \mathbf{if}\;d \leq 1.55 \cdot 10^{-96}:\\ \;\;\;\;a \cdot \left(c + b\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot d\\ \end{array} \]
Alternative 4
Error9.8
Cost452
\[\begin{array}{l} \mathbf{if}\;b \leq 2.5 \cdot 10^{-147}:\\ \;\;\;\;a \cdot \left(c + d\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(c + b\right)\\ \end{array} \]
Alternative 5
Error0.0
Cost448
\[a \cdot \left(d + \left(c + b\right)\right) \]
Alternative 6
Error0.0
Cost448
\[a \cdot \left(b + \left(c + d\right)\right) \]
Alternative 7
Error30.3
Cost324
\[\begin{array}{l} \mathbf{if}\;b \leq 4 \cdot 10^{-151}:\\ \;\;\;\;a \cdot c\\ \mathbf{else}:\\ \;\;\;\;a \cdot b\\ \end{array} \]
Alternative 8
Error41.3
Cost192
\[a \cdot b \]

Error

Reproduce?

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