?

Average Error: 0.03% → 0.03%
Time: 2.9s
Precision: binary64
Cost: 576

?

\[\left(1 - x\right) \cdot y + x \cdot z \]
\[\left(y - y \cdot x\right) + x \cdot z \]
(FPCore (x y z) :precision binary64 (+ (* (- 1.0 x) y) (* x z)))
(FPCore (x y z) :precision binary64 (+ (- y (* y x)) (* x z)))
double code(double x, double y, double z) {
	return ((1.0 - x) * y) + (x * z);
}
double code(double x, double y, double z) {
	return (y - (y * x)) + (x * z);
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = ((1.0d0 - x) * y) + (x * z)
end function
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (y - (y * x)) + (x * z)
end function
public static double code(double x, double y, double z) {
	return ((1.0 - x) * y) + (x * z);
}
public static double code(double x, double y, double z) {
	return (y - (y * x)) + (x * z);
}
def code(x, y, z):
	return ((1.0 - x) * y) + (x * z)
def code(x, y, z):
	return (y - (y * x)) + (x * z)
function code(x, y, z)
	return Float64(Float64(Float64(1.0 - x) * y) + Float64(x * z))
end
function code(x, y, z)
	return Float64(Float64(y - Float64(y * x)) + Float64(x * z))
end
function tmp = code(x, y, z)
	tmp = ((1.0 - x) * y) + (x * z);
end
function tmp = code(x, y, z)
	tmp = (y - (y * x)) + (x * z);
end
code[x_, y_, z_] := N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] + N[(x * z), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(N[(y - N[(y * x), $MachinePrecision]), $MachinePrecision] + N[(x * z), $MachinePrecision]), $MachinePrecision]
\left(1 - x\right) \cdot y + x \cdot z
\left(y - y \cdot x\right) + x \cdot z

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.03%
Target0.02%
Herbie0.03%
\[y - x \cdot \left(y - z\right) \]

Derivation?

  1. Initial program 0.03

    \[\left(1 - x\right) \cdot y + x \cdot z \]
  2. Applied egg-rr0.03

    \[\leadsto \color{blue}{\left(y + \left(-x\right) \cdot y\right)} + x \cdot z \]
  3. Final simplification0.03

    \[\leadsto \left(y - y \cdot x\right) + x \cdot z \]

Alternatives

Alternative 1
Error37.61%
Cost652
\[\begin{array}{l} t_0 := y \cdot \left(-x\right)\\ \mathbf{if}\;x \leq -5.5 \cdot 10^{+18}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq -1.28 \cdot 10^{-34}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error19.41%
Cost585
\[\begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{-40} \lor \neg \left(x \leq 1.7 \cdot 10^{-25}\right):\\ \;\;\;\;x \cdot \left(z - y\right)\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 3
Error1.36%
Cost585
\[\begin{array}{l} \mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\ \;\;\;\;x \cdot \left(z - y\right)\\ \mathbf{else}:\\ \;\;\;\;y + x \cdot z\\ \end{array} \]
Alternative 4
Error0.03%
Cost576
\[x \cdot z + y \cdot \left(1 - x\right) \]
Alternative 5
Error37.24%
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{-34}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;x \leq 8.6 \cdot 10^{-25}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]
Alternative 6
Error55.23%
Cost64
\[y \]

Error

Reproduce?

herbie shell --seed 2023115 
(FPCore (x y z)
  :name "Diagrams.Color.HSV:lerp  from diagrams-contrib-1.3.0.5"
  :precision binary64

  :herbie-target
  (- y (* x (- y z)))

  (+ (* (- 1.0 x) y) (* x z)))