?

Average Error: 15.9 → 0.0
Time: 2.0s
Precision: binary64
Cost: 448

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original15.9
Target0.0
Herbie0.0
\[y \cdot x - \left(y - 1\right) \]

Derivation?

  1. Initial program 15.9

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

    \[\leadsto \color{blue}{y \cdot \left(x + -1\right) + 1} \]
    Proof

    [Start]15.9

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

    rational_best_oopsla_all_46_json_45_simplify-87 [=>]15.9

    \[ x + \color{blue}{\left(-\left(1 - x\right)\right) \cdot \left(y - 1\right)} \]

    rational_best_oopsla_all_46_json_45_simplify-13 [=>]15.9

    \[ x + \color{blue}{\left(y \cdot \left(-\left(1 - x\right)\right) - \left(-\left(1 - x\right)\right) \cdot 1\right)} \]

    rational_best_oopsla_all_46_json_45_simplify-52 [=>]15.9

    \[ x + \left(y \cdot \left(-\left(1 - x\right)\right) - \color{blue}{\left(-\left(1 - x\right)\right)}\right) \]

    rational_best_oopsla_all_46_json_45_simplify-97 [=>]15.9

    \[ x + \left(y \cdot \left(-\left(1 - x\right)\right) - \color{blue}{\left(0 - \left(1 - x\right)\right)}\right) \]

    rational_best_oopsla_all_46_json_45_simplify-36 [=>]15.9

    \[ x + \left(y \cdot \left(-\left(1 - x\right)\right) - \color{blue}{\left(x - \left(1 - 0\right)\right)}\right) \]

    metadata-eval [=>]15.9

    \[ x + \left(y \cdot \left(-\left(1 - x\right)\right) - \left(x - \color{blue}{1}\right)\right) \]

    rational_best_oopsla_all_46_json_45_simplify-45 [=>]15.9

    \[ x + \left(y \cdot \left(-\left(1 - x\right)\right) - \color{blue}{\left(x + -1\right)}\right) \]

    rational_best_oopsla_all_46_json_45_simplify-109 [=>]0.0

    \[ \color{blue}{y \cdot \left(-\left(1 - x\right)\right) - -1} \]

    rational_best_oopsla_all_46_json_45_simplify-1 [=>]0.0

    \[ \color{blue}{y \cdot \left(-\left(1 - x\right)\right) + 1} \]

    rational_best_oopsla_all_46_json_45_simplify-97 [=>]0.0

    \[ y \cdot \color{blue}{\left(0 - \left(1 - x\right)\right)} + 1 \]

    rational_best_oopsla_all_46_json_45_simplify-36 [=>]0.0

    \[ y \cdot \color{blue}{\left(x - \left(1 - 0\right)\right)} + 1 \]

    metadata-eval [=>]0.0

    \[ y \cdot \left(x - \color{blue}{1}\right) + 1 \]

    rational_best_oopsla_all_46_json_45_simplify-45 [=>]0.0

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

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

Alternatives

Alternative 1
Error9.9
Cost584
\[\begin{array}{l} t_0 := y \cdot \left(x - 1\right)\\ \mathbf{if}\;y \leq -360000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.65 \cdot 10^{-43}:\\ \;\;\;\;1 - y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error27.7
Cost456
\[\begin{array}{l} \mathbf{if}\;y \leq -2.5 \cdot 10^{-24}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq 1.55 \cdot 10^{-43}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 3
Error9.8
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -4.6 \cdot 10^{+48}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;x \leq 4 \cdot 10^{+90}:\\ \;\;\;\;1 - y\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 4
Error36.5
Cost64
\[1 \]

Error

Reproduce?

herbie shell --seed 2023090 
(FPCore (x y)
  :name "Graphics.Rendering.Chart.Plot.Vectors:renderPlotVectors from Chart-1.5.3"
  :precision binary64

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

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