Average Error: 7.3 → 1.9
Time: 3.4s
Precision: binary64
\[\frac{x \cdot 2}{y \cdot z - t \cdot z}\]
\[\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \left(\frac{2}{y - t} \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{z}}\right)\]
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \left(\frac{2}{y - t} \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{z}}\right)
(FPCore (x y z t) :precision binary64 (/ (* x 2.0) (- (* y z) (* t z))))
(FPCore (x y z t)
 :precision binary64
 (*
  (/ (* (cbrt x) (cbrt x)) (* (cbrt z) (cbrt z)))
  (* (/ 2.0 (- y t)) (/ (cbrt x) (cbrt z)))))
double code(double x, double y, double z, double t) {
	return (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (t * z)))));
}
double code(double x, double y, double z, double t) {
	return ((double) ((((double) (((double) cbrt(x)) * ((double) cbrt(x)))) / ((double) (((double) cbrt(z)) * ((double) cbrt(z))))) * ((double) ((2.0 / ((double) (y - t))) * (((double) cbrt(x)) / ((double) cbrt(z)))))));
}

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

Original7.3
Target2.1
Herbie1.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.0450278273301259 \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 Error: 7.3 bits

    \[\frac{x \cdot 2}{y \cdot z - t \cdot z}\]
  2. SimplifiedError: 6.3 bits

    \[\leadsto \color{blue}{x \cdot \frac{2}{z \cdot \left(y - t\right)}}\]
  3. Using strategy rm
  4. Applied *-un-lft-identityError: 6.3 bits

    \[\leadsto x \cdot \frac{\color{blue}{1 \cdot 2}}{z \cdot \left(y - t\right)}\]
  5. Applied times-fracError: 6.0 bits

    \[\leadsto x \cdot \color{blue}{\left(\frac{1}{z} \cdot \frac{2}{y - t}\right)}\]
  6. Applied associate-*r*Error: 5.8 bits

    \[\leadsto \color{blue}{\left(x \cdot \frac{1}{z}\right) \cdot \frac{2}{y - t}}\]
  7. SimplifiedError: 5.8 bits

    \[\leadsto \color{blue}{\frac{x}{z}} \cdot \frac{2}{y - t}\]
  8. Using strategy rm
  9. Applied add-cube-cbrtError: 6.4 bits

    \[\leadsto \frac{x}{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}} \cdot \frac{2}{y - t}\]
  10. Applied add-cube-cbrtError: 6.6 bits

    \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}} \cdot \frac{2}{y - t}\]
  11. Applied times-fracError: 6.6 bits

    \[\leadsto \color{blue}{\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{z}}\right)} \cdot \frac{2}{y - t}\]
  12. Applied associate-*l*Error: 1.9 bits

    \[\leadsto \color{blue}{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \left(\frac{\sqrt[3]{x}}{\sqrt[3]{z}} \cdot \frac{2}{y - t}\right)}\]
  13. SimplifiedError: 1.9 bits

    \[\leadsto \frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \color{blue}{\left(\frac{2}{y - t} \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{z}}\right)}\]
  14. Final simplificationError: 1.9 bits

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

Reproduce

herbie shell --seed 2020203 
(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.0450278273301259e-269) (/ (* (/ x z) 2.0) (- y t)) (* (/ x (* (- y t) z)) 2.0)))

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