Average Error: 6.8 → 1.8
Time: 1.1m
Precision: 64
Internal Precision: 384
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;\left(x \cdot y - z \cdot y\right) \cdot t \le -8.133168452079859 \cdot 10^{-12}:\\ \;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\ \mathbf{if}\;\left(x \cdot y - z \cdot y\right) \cdot t \le -4.8833559329525755 \cdot 10^{-298}:\\ \;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\ \mathbf{if}\;\left(x \cdot y - z \cdot y\right) \cdot t \le 9.3577914576289 \cdot 10^{-312}:\\ \;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\ \mathbf{if}\;\left(x \cdot y - z \cdot y\right) \cdot t \le 2.1694115241135858 \cdot 10^{-36}:\\ \;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original6.8
Target2.9
Herbie1.8
\[\begin{array}{l} \mathbf{if}\;t \lt -9.231879582886777 \cdot 10^{-80}:\\ \;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\ \mathbf{if}\;t \lt 2.543067051564877 \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 2 regimes
  2. if (* (- (* x y) (* z y)) t) < -8.133168452079859e-12 or -4.8833559329525755e-298 < (* (- (* x y) (* z y)) t) < 9.3577914576289e-312 or 2.1694115241135858e-36 < (* (- (* x y) (* z y)) t)

    1. Initial program 9.1

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Applied simplify2.3

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

    if -8.133168452079859e-12 < (* (- (* x y) (* z y)) t) < -4.8833559329525755e-298 or 9.3577914576289e-312 < (* (- (* x y) (* z y)) t) < 2.1694115241135858e-36

    1. Initial program 1.7

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Applied simplify16.2

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

      \[\leadsto \color{blue}{t \cdot \left(y \cdot \left(x - z\right)\right)}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 1.1m)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:inverseInfinitePerspective from linear-1.19.1.3"

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