?

Average Error: 0.0 → 0.0
Time: 10.5s
Precision: binary64
Cost: 1216

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0.0
Herbie0.0
\[\frac{1}{\frac{x}{x + y} - \frac{y}{x + y}} \]

Derivation?

  1. Initial program 0.0

    \[\frac{x + y}{x - y} \]
  2. Applied egg-rr0.0

    \[\leadsto \color{blue}{\left(1 - \frac{x + y}{y - x}\right) + -1} \]
  3. Applied egg-rr0.0

    \[\leadsto \color{blue}{1 - \left(1 + \frac{x + y}{y - x}\right)} \]
  4. Applied egg-rr0.0

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

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

Alternatives

Alternative 1
Error18.2
Cost976
\[\begin{array}{l} t_0 := 1 + 2 \cdot \frac{y}{x}\\ \mathbf{if}\;y \leq -1.45 \cdot 10^{-96}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 1.7 \cdot 10^{-81}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 0.025:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 2.1 \cdot 10^{+83}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 2
Error17.8
Cost976
\[\begin{array}{l} t_0 := -2 \cdot \frac{x}{y} - 1\\ t_1 := 1 + 2 \cdot \frac{y}{x}\\ \mathbf{if}\;y \leq -1.52 \cdot 10^{-96}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{-80}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-6}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{+83}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error0.0
Cost960
\[\frac{x - y}{\left(x - y\right) \cdot \frac{x - y}{x + y}} \]
Alternative 4
Error18.5
Cost592
\[\begin{array}{l} \mathbf{if}\;y \leq -1.52 \cdot 10^{-96}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{-81}:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-5}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+82}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
Alternative 5
Error0.0
Cost448
\[\frac{x + y}{x - y} \]
Alternative 6
Error32.4
Cost64
\[-1 \]

Error

Reproduce?

herbie shell --seed 2023064 
(FPCore (x y)
  :name "Linear.Projection:perspective from linear-1.19.1.3, A"
  :precision binary64

  :herbie-target
  (/ 1.0 (- (/ x (+ x y)) (/ y (+ x y))))

  (/ (+ x y) (- x y)))