?

Average Error: 6.9 → 5.9
Time: 5.3s
Precision: binary64
Cost: 576

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.9
Target2.5
Herbie5.9
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot 2}{y \cdot z - t \cdot z} < -2.559141628295061 \cdot 10^{-13}:\\ \;\;\;\;\frac{x}{\left(y - t\right) \cdot z} \cdot 2\\ \mathbf{elif}\;\frac{x \cdot 2}{y \cdot z - t \cdot z} < 1.045027827330126 \cdot 10^{-269}:\\ \;\;\;\;\frac{\frac{x}{z} \cdot 2}{y - t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(y - t\right) \cdot z} \cdot 2\\ \end{array} \]

Derivation?

  1. Initial program 6.9

    \[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
  2. Simplified5.9

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

    [Start]6.9

    \[ \frac{x \cdot 2}{y \cdot z - t \cdot z} \]

    metadata-eval [<=]6.9

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

    metadata-eval [<=]6.9

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

    metadata-eval [<=]6.9

    \[ \frac{x \cdot \left(\frac{2}{2} + \color{blue}{\frac{2}{2}}\right)}{y \cdot z - t \cdot z} \]

    rational_best_oopsla_all_46_json_45_simplify-23 [<=]6.9

    \[ \frac{\color{blue}{\frac{2}{2} \cdot x + x \cdot \frac{2}{2}}}{y \cdot z - t \cdot z} \]

    rational_best_oopsla_all_46_json_45_simplify-74 [<=]6.9

    \[ \frac{\color{blue}{x \cdot \frac{2}{2}} + x \cdot \frac{2}{2}}{y \cdot z - t \cdot z} \]

    metadata-eval [=>]6.9

    \[ \frac{x \cdot \color{blue}{1} + x \cdot \frac{2}{2}}{y \cdot z - t \cdot z} \]

    rational_best_oopsla_all_46_json_45_simplify-52 [=>]6.9

    \[ \frac{\color{blue}{x} + x \cdot \frac{2}{2}}{y \cdot z - t \cdot z} \]

    metadata-eval [=>]6.9

    \[ \frac{x + x \cdot \color{blue}{1}}{y \cdot z - t \cdot z} \]

    rational_best_oopsla_all_46_json_45_simplify-52 [=>]6.9

    \[ \frac{x + \color{blue}{x}}{y \cdot z - t \cdot z} \]

    rational_best_oopsla_all_46_json_45_simplify-74 [=>]6.9

    \[ \frac{x + x}{y \cdot z - \color{blue}{z \cdot t}} \]

    rational_best_oopsla_all_46_json_45_simplify-102 [=>]5.9

    \[ \frac{x + x}{\color{blue}{z \cdot \left(y - t\right)}} \]
  3. Final simplification5.9

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

Alternatives

Alternative 1
Error17.0
Cost712
\[\begin{array}{l} t_1 := -2 \cdot \frac{x}{t \cdot z}\\ \mathbf{if}\;t \leq -1.4 \cdot 10^{+34}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 4.6 \cdot 10^{-12}:\\ \;\;\;\;\frac{x + x}{y \cdot z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error31.2
Cost448
\[-2 \cdot \frac{x}{t \cdot z} \]

Error

Reproduce?

herbie shell --seed 2023090 
(FPCore (x y z t)
  :name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
  :precision binary64

  :herbie-target
  (if (< (/ (* x 2.0) (- (* y z) (* t z))) -2.559141628295061e-13) (* (/ x (* (- y t) z)) 2.0) (if (< (/ (* x 2.0) (- (* y z) (* t z))) 1.045027827330126e-269) (/ (* (/ x z) 2.0) (- y t)) (* (/ x (* (- y t) z)) 2.0)))

  (/ (* x 2.0) (- (* y z) (* t z))))