Average Error: 7.2 → 5.1
Time: 4.7s
Precision: binary64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.6472230079801522 \cdot 10^{-139}:\\ \;\;\;\;t \cdot \left(x \cdot y\right) + \left(t \cdot \left(-z\right)\right) \cdot y\\ \mathbf{elif}\;y \le 2.9072852134162777 \cdot 10^{-123}:\\ \;\;\;\;\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \left(\sqrt[3]{t} \cdot \left(y \cdot \left(x - z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t \cdot y\right) \cdot x + \left(t \cdot y\right) \cdot \left(-z\right)\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original7.2
Target3.3
Herbie5.1
\[\begin{array}{l} \mathbf{if}\;t \lt -9.2318795828867769 \cdot 10^{-80}:\\ \;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;t \lt 2.5430670515648771 \cdot 10^{83}:\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if y < -2.6472230079801522e-139

    1. Initial program 9.7

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified9.7

      \[\leadsto \color{blue}{t \cdot \left(y \cdot \left(x - z\right)\right)}\]
    3. Using strategy rm
    4. Applied sub-neg9.7

      \[\leadsto t \cdot \left(y \cdot \color{blue}{\left(x + \left(-z\right)\right)}\right)\]
    5. Applied distribute-lft-in9.7

      \[\leadsto t \cdot \color{blue}{\left(y \cdot x + y \cdot \left(-z\right)\right)}\]
    6. Applied distribute-lft-in9.7

      \[\leadsto \color{blue}{t \cdot \left(y \cdot x\right) + t \cdot \left(y \cdot \left(-z\right)\right)}\]
    7. Simplified9.7

      \[\leadsto \color{blue}{t \cdot \left(x \cdot y\right)} + t \cdot \left(y \cdot \left(-z\right)\right)\]
    8. Simplified9.7

      \[\leadsto t \cdot \left(x \cdot y\right) + \color{blue}{t \cdot \left(\left(-z\right) \cdot y\right)}\]
    9. Using strategy rm
    10. Applied associate-*r*7.9

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

    if -2.6472230079801522e-139 < y < 2.9072852134162777e-123

    1. Initial program 3.0

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified3.0

      \[\leadsto \color{blue}{t \cdot \left(y \cdot \left(x - z\right)\right)}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt3.8

      \[\leadsto \color{blue}{\left(\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}\right)} \cdot \left(y \cdot \left(x - z\right)\right)\]
    5. Applied associate-*l*3.8

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

    if 2.9072852134162777e-123 < y

    1. Initial program 9.8

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified9.8

      \[\leadsto \color{blue}{t \cdot \left(y \cdot \left(x - z\right)\right)}\]
    3. Using strategy rm
    4. Applied associate-*r*3.9

      \[\leadsto \color{blue}{\left(t \cdot y\right) \cdot \left(x - z\right)}\]
    5. Using strategy rm
    6. Applied sub-neg3.9

      \[\leadsto \left(t \cdot y\right) \cdot \color{blue}{\left(x + \left(-z\right)\right)}\]
    7. Applied distribute-lft-in4.0

      \[\leadsto \color{blue}{\left(t \cdot y\right) \cdot x + \left(t \cdot y\right) \cdot \left(-z\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification5.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -2.6472230079801522 \cdot 10^{-139}:\\ \;\;\;\;t \cdot \left(x \cdot y\right) + \left(t \cdot \left(-z\right)\right) \cdot y\\ \mathbf{elif}\;y \le 2.9072852134162777 \cdot 10^{-123}:\\ \;\;\;\;\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \left(\sqrt[3]{t} \cdot \left(y \cdot \left(x - z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t \cdot y\right) \cdot x + \left(t \cdot y\right) \cdot \left(-z\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020173 
(FPCore (x y z t)
  :name "Linear.Projection:inverseInfinitePerspective from linear-1.19.1.3"
  :precision binary64

  :herbie-target
  (if (< t -9.231879582886777e-80) (* (* y t) (- x z)) (if (< t 2.543067051564877e+83) (* y (* t (- x z))) (* (* y (- x z)) t)))

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