Average Error: 6.8 → 1.8
Time: 41.6s
Precision: 64
Internal Precision: 384
\[\frac{x \cdot 2.0}{y \cdot z - t \cdot z}\]
\[\left(x \cdot \frac{\sqrt[3]{\frac{2.0}{z}} \cdot \sqrt[3]{\frac{2.0}{z}}}{\sqrt[3]{y - t} \cdot \sqrt[3]{y - t}}\right) \cdot \frac{\sqrt[3]{\frac{2.0}{z}}}{\sqrt[3]{y - t}}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original6.8
Target2.2
Herbie1.8
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot 2.0}{y \cdot z - t \cdot z} \lt -2.559141628295061 \cdot 10^{-13}:\\ \;\;\;\;\frac{x}{\left(y - t\right) \cdot z} \cdot 2.0\\ \mathbf{if}\;\frac{x \cdot 2.0}{y \cdot z - t \cdot z} \lt 1.045027827330126 \cdot 10^{-269}:\\ \;\;\;\;\frac{\frac{x}{z} \cdot 2.0}{y - t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(y - t\right) \cdot z} \cdot 2.0\\ \end{array}\]

Derivation

  1. Initial program 6.8

    \[\frac{x \cdot 2.0}{y \cdot z - t \cdot z}\]
  2. Applied simplify5.9

    \[\leadsto \color{blue}{\frac{x}{z} \cdot \frac{2.0}{y - t}}\]
  3. Using strategy rm
  4. Applied div-inv5.9

    \[\leadsto \color{blue}{\left(x \cdot \frac{1}{z}\right)} \cdot \frac{2.0}{y - t}\]
  5. Applied associate-*l*5.6

    \[\leadsto \color{blue}{x \cdot \left(\frac{1}{z} \cdot \frac{2.0}{y - t}\right)}\]
  6. Applied simplify5.6

    \[\leadsto x \cdot \color{blue}{\frac{\frac{2.0}{z}}{y - t}}\]
  7. Using strategy rm
  8. Applied add-cube-cbrt6.2

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

    \[\leadsto x \cdot \frac{\color{blue}{\left(\sqrt[3]{\frac{2.0}{z}} \cdot \sqrt[3]{\frac{2.0}{z}}\right) \cdot \sqrt[3]{\frac{2.0}{z}}}}{\left(\sqrt[3]{y - t} \cdot \sqrt[3]{y - t}\right) \cdot \sqrt[3]{y - t}}\]
  10. Applied times-frac6.4

    \[\leadsto x \cdot \color{blue}{\left(\frac{\sqrt[3]{\frac{2.0}{z}} \cdot \sqrt[3]{\frac{2.0}{z}}}{\sqrt[3]{y - t} \cdot \sqrt[3]{y - t}} \cdot \frac{\sqrt[3]{\frac{2.0}{z}}}{\sqrt[3]{y - t}}\right)}\]
  11. Applied associate-*r*1.8

    \[\leadsto \color{blue}{\left(x \cdot \frac{\sqrt[3]{\frac{2.0}{z}} \cdot \sqrt[3]{\frac{2.0}{z}}}{\sqrt[3]{y - t} \cdot \sqrt[3]{y - t}}\right) \cdot \frac{\sqrt[3]{\frac{2.0}{z}}}{\sqrt[3]{y - t}}}\]
  12. Removed slow pow expressions.

Runtime

Time bar (total: 41.6s)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit +o reduce:binary-search
(FPCore (x y z t)
  :name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"

  :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))))