?

Average Error: 0.0 → 0.0
Time: 17.7s
Precision: binary64
Cost: 960

?

\[\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1 \]
\[\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1 \]
(FPCore (d1 d2 d3 d4)
 :precision binary64
 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
(FPCore (d1 d2 d3 d4)
 :precision binary64
 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
	return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
double code(double d1, double d2, double d3, double d4) {
	return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
    real(8), intent (in) :: d1
    real(8), intent (in) :: d2
    real(8), intent (in) :: d3
    real(8), intent (in) :: d4
    code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
real(8) function code(d1, d2, d3, d4)
    real(8), intent (in) :: d1
    real(8), intent (in) :: d2
    real(8), intent (in) :: d3
    real(8), intent (in) :: d4
    code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
	return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
public static double code(double d1, double d2, double d3, double d4) {
	return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4):
	return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
def code(d1, d2, d3, d4):
	return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4)
	return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1))
end
function code(d1, d2, d3, d4)
	return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1))
end
function tmp = code(d1, d2, d3, d4)
	tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
end
function tmp = code(d1, d2, d3, d4)
	tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0.0
Herbie0.0
\[d1 \cdot \left(\left(\left(d2 - d3\right) + d4\right) - d1\right) \]

Derivation?

  1. Initial program 0.0

    \[\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1 \]
  2. Final simplification0.0

    \[\leadsto \left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1 \]

Alternatives

Alternative 1
Error33.1
Cost916
\[\begin{array}{l} t_0 := d1 \cdot \left(-d3\right)\\ \mathbf{if}\;d3 \leq -1.72 \cdot 10^{+131}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d3 \leq -1.1 \cdot 10^{-258}:\\ \;\;\;\;d1 \cdot d4\\ \mathbf{elif}\;d3 \leq 3 \cdot 10^{-281}:\\ \;\;\;\;d2 \cdot d1\\ \mathbf{elif}\;d3 \leq 2.6 \cdot 10^{-138}:\\ \;\;\;\;d1 \cdot d4\\ \mathbf{elif}\;d3 \leq 8 \cdot 10^{+49}:\\ \;\;\;\;d2 \cdot d1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error19.2
Cost848
\[\begin{array}{l} t_0 := d1 \cdot \left(-d3\right)\\ t_1 := d1 \cdot \left(d4 + d2\right)\\ \mathbf{if}\;d3 \leq -1.56 \cdot 10^{+131}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d3 \leq 8.2 \cdot 10^{-88}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d3 \leq 1.15 \cdot 10^{-15}:\\ \;\;\;\;\left(d2 - d1\right) \cdot d1\\ \mathbf{elif}\;d3 \leq 8.5 \cdot 10^{+49}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error16.0
Cost848
\[\begin{array}{l} t_0 := \left(d2 - d3\right) \cdot d1\\ t_1 := d1 \cdot \left(d4 + d2\right)\\ \mathbf{if}\;d3 \leq -1.72 \cdot 10^{+131}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d3 \leq 8.2 \cdot 10^{-88}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d3 \leq 1.7 \cdot 10^{-15}:\\ \;\;\;\;\left(d2 - d1\right) \cdot d1\\ \mathbf{elif}\;d3 \leq 6.6 \cdot 10^{+46}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error15.3
Cost848
\[\begin{array}{l} t_0 := d1 \cdot \left(d4 + d2\right)\\ \mathbf{if}\;d3 \leq -4.6 \cdot 10^{+86}:\\ \;\;\;\;\left(d4 - d3\right) \cdot d1\\ \mathbf{elif}\;d3 \leq 8.2 \cdot 10^{-88}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d3 \leq 1.15 \cdot 10^{-15}:\\ \;\;\;\;\left(d2 - d1\right) \cdot d1\\ \mathbf{elif}\;d3 \leq 1.12 \cdot 10^{+49}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\left(d2 - d3\right) \cdot d1\\ \end{array} \]
Alternative 5
Error33.2
Cost720
\[\begin{array}{l} \mathbf{if}\;d4 \leq -1.05 \cdot 10^{+49}:\\ \;\;\;\;d1 \cdot d4\\ \mathbf{elif}\;d4 \leq 7.2 \cdot 10^{+83}:\\ \;\;\;\;d2 \cdot d1\\ \mathbf{elif}\;d4 \leq 1.2 \cdot 10^{+146}:\\ \;\;\;\;d1 \cdot d4\\ \mathbf{elif}\;d4 \leq 1.1 \cdot 10^{+169}:\\ \;\;\;\;d2 \cdot d1\\ \mathbf{else}:\\ \;\;\;\;d1 \cdot d4\\ \end{array} \]
Alternative 6
Error2.9
Cost712
\[\begin{array}{l} t_0 := d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\ \mathbf{if}\;d4 \leq -8 \cdot 10^{+23}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d4 \leq 1.1 \cdot 10^{-21}:\\ \;\;\;\;\left(d2 - \left(d1 + d3\right)\right) \cdot d1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error0.0
Cost704
\[d1 \cdot \left(d4 + \left(d2 - d3\right)\right) - d1 \cdot d1 \]
Alternative 8
Error18.2
Cost584
\[\begin{array}{l} t_0 := d1 \cdot \left(-d3\right)\\ \mathbf{if}\;d3 \leq -1.56 \cdot 10^{+131}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d3 \leq 8.5 \cdot 10^{+49}:\\ \;\;\;\;d1 \cdot \left(d4 + d2\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Error0.0
Cost576
\[d1 \cdot \left(\left(d4 + \left(d2 - d3\right)\right) - d1\right) \]
Alternative 10
Error7.6
Cost448
\[d1 \cdot \left(\left(d2 + d4\right) - d3\right) \]
Alternative 11
Error43.7
Cost192
\[d1 \cdot d4 \]

Error

Reproduce?

herbie shell --seed 2023077 
(FPCore (d1 d2 d3 d4)
  :name "FastMath dist4"
  :precision binary64

  :herbie-target
  (* d1 (- (+ (- d2 d3) d4) d1))

  (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))