Average Error: 0.0 → 0.0
Time: 3.7s
Precision: binary64
Cost: 448
\[\frac{x - y}{1 - y} \]
\[\frac{y - x}{y + -1} \]
(FPCore (x y) :precision binary64 (/ (- x y) (- 1.0 y)))
(FPCore (x y) :precision binary64 (/ (- y x) (+ y -1.0)))
double code(double x, double y) {
	return (x - y) / (1.0 - y);
}
double code(double x, double y) {
	return (y - x) / (y + -1.0);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x - y) / (1.0d0 - y)
end function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (y - x) / (y + (-1.0d0))
end function
public static double code(double x, double y) {
	return (x - y) / (1.0 - y);
}
public static double code(double x, double y) {
	return (y - x) / (y + -1.0);
}
def code(x, y):
	return (x - y) / (1.0 - y)
def code(x, y):
	return (y - x) / (y + -1.0)
function code(x, y)
	return Float64(Float64(x - y) / Float64(1.0 - y))
end
function code(x, y)
	return Float64(Float64(y - x) / Float64(y + -1.0))
end
function tmp = code(x, y)
	tmp = (x - y) / (1.0 - y);
end
function tmp = code(x, y)
	tmp = (y - x) / (y + -1.0);
end
code[x_, y_] := N[(N[(x - y), $MachinePrecision] / N[(1.0 - y), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(N[(y - x), $MachinePrecision] / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]
\frac{x - y}{1 - y}
\frac{y - x}{y + -1}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[\frac{x - y}{1 - y} \]
  2. Simplified0.0

    \[\leadsto \color{blue}{\frac{y - x}{y - 1}} \]
  3. Final simplification0.0

    \[\leadsto \frac{y - x}{y + -1} \]

Alternatives

Alternative 1
Error16.7
Cost1112
\[\begin{array}{l} t_0 := \frac{y}{y + -1}\\ t_1 := \frac{-x}{y}\\ \mathbf{if}\;y \leq -6.338796297283814 \cdot 10^{+109}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -2.513010796666266 \cdot 10^{+76}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -3.1137826412351986 \cdot 10^{+36}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -260063922.78684554:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.0792687319627692 \cdot 10^{-23}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 3.068064643996948 \cdot 10^{-24}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error17.3
Cost856
\[\begin{array}{l} t_0 := \frac{-x}{y}\\ \mathbf{if}\;y \leq -6.338796297283814 \cdot 10^{+109}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -2.513010796666266 \cdot 10^{+76}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -3.1137826412351986 \cdot 10^{+36}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq -260063922.78684554:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -7158563.034633967:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 0.18559351823731515:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 3
Error16.3
Cost584
\[\begin{array}{l} t_0 := \frac{x}{1 - y}\\ \mathbf{if}\;x \leq -0.22652031560864966:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 1.9321132850578965 \cdot 10^{-62}:\\ \;\;\;\;\frac{y}{y + -1}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error16.6
Cost328
\[\begin{array}{l} \mathbf{if}\;y \leq -7158563.034633967:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 0.18559351823731515:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 5
Error38.9
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2022325 
(FPCore (x y)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, C"
  :precision binary64
  (/ (- x y) (- 1.0 y)))