Average Error: 6.9 → 1.8
Time: 7.4s
Precision: binary64
\[\frac{x \cdot 2}{y \cdot z - t \cdot z} \]
\[\begin{array}{l} t_1 := \sqrt[3]{\frac{2}{y - t}}\\ \left(x \cdot \frac{t_1 \cdot t_1}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\right) \cdot \frac{t_1}{\sqrt[3]{z}} \end{array} \]
(FPCore (x y z t) :precision binary64 (/ (* x 2.0) (- (* y z) (* t z))))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (cbrt (/ 2.0 (- y t)))))
   (* (* x (/ (* t_1 t_1) (* (cbrt z) (cbrt z)))) (/ t_1 (cbrt z)))))
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) {
	double t_1 = cbrt((2.0 / (y - t)));
	return (x * ((t_1 * t_1) / (cbrt(z) * cbrt(z)))) * (t_1 / cbrt(z));
}
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) {
	double t_1 = Math.cbrt((2.0 / (y - t)));
	return (x * ((t_1 * t_1) / (Math.cbrt(z) * Math.cbrt(z)))) * (t_1 / Math.cbrt(z));
}
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)
	t_1 = cbrt(Float64(2.0 / Float64(y - t)))
	return Float64(Float64(x * Float64(Float64(t_1 * t_1) / Float64(cbrt(z) * cbrt(z)))) * Float64(t_1 / cbrt(z)))
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_] := Block[{t$95$1 = N[Power[N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[(x * N[(N[(t$95$1 * t$95$1), $MachinePrecision] / N[(N[Power[z, 1/3], $MachinePrecision] * N[Power[z, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 / N[Power[z, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\begin{array}{l}
t_1 := \sqrt[3]{\frac{2}{y - t}}\\
\left(x \cdot \frac{t_1 \cdot t_1}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\right) \cdot \frac{t_1}{\sqrt[3]{z}}
\end{array}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.9
Target2.1
Herbie1.8
\[\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.6

    \[\leadsto \color{blue}{x \cdot \frac{\frac{2}{y - t}}{z}} \]
  3. Applied add-cube-cbrt_binary646.3

    \[\leadsto x \cdot \frac{\frac{2}{y - t}}{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}} \]
  4. Applied add-cube-cbrt_binary646.5

    \[\leadsto x \cdot \frac{\color{blue}{\left(\sqrt[3]{\frac{2}{y - t}} \cdot \sqrt[3]{\frac{2}{y - t}}\right) \cdot \sqrt[3]{\frac{2}{y - t}}}}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}} \]
  5. Applied times-frac_binary646.5

    \[\leadsto x \cdot \color{blue}{\left(\frac{\sqrt[3]{\frac{2}{y - t}} \cdot \sqrt[3]{\frac{2}{y - t}}}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \frac{\sqrt[3]{\frac{2}{y - t}}}{\sqrt[3]{z}}\right)} \]
  6. Applied associate-*r*_binary641.8

    \[\leadsto \color{blue}{\left(x \cdot \frac{\sqrt[3]{\frac{2}{y - t}} \cdot \sqrt[3]{\frac{2}{y - t}}}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\right) \cdot \frac{\sqrt[3]{\frac{2}{y - t}}}{\sqrt[3]{z}}} \]
  7. Final simplification1.8

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

Reproduce

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