?

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

?

\[\left(1 - x\right) \cdot y + x \cdot z \]
\[x \cdot z + \left(1 - x\right) \cdot y \]
(FPCore (x y z) :precision binary64 (+ (* (- 1.0 x) y) (* x z)))
(FPCore (x y z) :precision binary64 (+ (* x z) (* (- 1.0 x) y)))
double code(double x, double y, double z) {
	return ((1.0 - x) * y) + (x * z);
}
double code(double x, double y, double z) {
	return (x * z) + ((1.0 - x) * y);
}
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 = (x * z) + ((1.0d0 - x) * y)
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 (x * z) + ((1.0 - x) * y);
}
def code(x, y, z):
	return ((1.0 - x) * y) + (x * z)
def code(x, y, z):
	return (x * z) + ((1.0 - x) * y)
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(x * z) + Float64(Float64(1.0 - x) * y))
end
function tmp = code(x, y, z)
	tmp = ((1.0 - x) * y) + (x * z);
end
function tmp = code(x, y, z)
	tmp = (x * z) + ((1.0 - x) * y);
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[(x * z), $MachinePrecision] + N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]
\left(1 - x\right) \cdot y + x \cdot z
x \cdot z + \left(1 - x\right) \cdot y

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation?

  1. Initial program 0.0

    \[\left(1 - x\right) \cdot y + x \cdot z \]
  2. Final simplification0.0

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

Alternatives

Alternative 1
Error16.1
Cost585
\[\begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{-131} \lor \neg \left(y \leq 2.05 \cdot 10^{-60}\right):\\ \;\;\;\;\left(1 - x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]
Alternative 2
Error13.3
Cost585
\[\begin{array}{l} \mathbf{if}\;y \leq -1.2 \cdot 10^{-55} \lor \neg \left(y \leq 9.5 \cdot 10^{-49}\right):\\ \;\;\;\;\left(1 - x\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z - y\right)\\ \end{array} \]
Alternative 3
Error0.9
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
Error24.7
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{-93}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 10^{-48}:\\ \;\;\;\;x \cdot z\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 5
Error0.0
Cost448
\[y + x \cdot \left(z - y\right) \]
Alternative 6
Error34.4
Cost64
\[y \]

Error

Reproduce?

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