Average Error: 6.7 → 2.6
Time: 2.7s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;t \le -5.37701967139328379 \cdot 10^{85}:\\ \;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\ \mathbf{elif}\;t \le 2.0780664373971253 \cdot 10^{-22}:\\ \;\;\;\;1 \cdot \left(\left(\left(x - z\right) \cdot t\right) \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\left(x - z\right) \cdot \left(t \cdot y\right)\right)\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;t \le -5.37701967139328379 \cdot 10^{85}:\\
\;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\

\mathbf{elif}\;t \le 2.0780664373971253 \cdot 10^{-22}:\\
\;\;\;\;1 \cdot \left(\left(\left(x - z\right) \cdot t\right) \cdot y\right)\\

\mathbf{else}:\\
\;\;\;\;1 \cdot \left(\left(x - z\right) \cdot \left(t \cdot y\right)\right)\\

\end{array}
double f(double x, double y, double z, double t) {
        double r437109 = x;
        double r437110 = y;
        double r437111 = r437109 * r437110;
        double r437112 = z;
        double r437113 = r437112 * r437110;
        double r437114 = r437111 - r437113;
        double r437115 = t;
        double r437116 = r437114 * r437115;
        return r437116;
}

double f(double x, double y, double z, double t) {
        double r437117 = t;
        double r437118 = -5.377019671393284e+85;
        bool r437119 = r437117 <= r437118;
        double r437120 = y;
        double r437121 = x;
        double r437122 = z;
        double r437123 = r437121 - r437122;
        double r437124 = r437120 * r437123;
        double r437125 = r437117 * r437124;
        double r437126 = 2.0780664373971253e-22;
        bool r437127 = r437117 <= r437126;
        double r437128 = 1.0;
        double r437129 = r437123 * r437117;
        double r437130 = r437129 * r437120;
        double r437131 = r437128 * r437130;
        double r437132 = r437117 * r437120;
        double r437133 = r437123 * r437132;
        double r437134 = r437128 * r437133;
        double r437135 = r437127 ? r437131 : r437134;
        double r437136 = r437119 ? r437125 : r437135;
        return r437136;
}

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.7
Target2.8
Herbie2.6
\[\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 t < -5.377019671393284e+85

    1. Initial program 4.0

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

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

    if -5.377019671393284e+85 < t < 2.0780664373971253e-22

    1. Initial program 8.5

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified8.5

      \[\leadsto \color{blue}{t \cdot \left(y \cdot \left(x - z\right)\right)}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity8.5

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

      \[\leadsto \color{blue}{1 \cdot \left(t \cdot \left(y \cdot \left(x - z\right)\right)\right)}\]
    6. Simplified7.9

      \[\leadsto 1 \cdot \color{blue}{\left(\left(x - z\right) \cdot \left(t \cdot y\right)\right)}\]
    7. Using strategy rm
    8. Applied associate-*r*2.2

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

    if 2.0780664373971253e-22 < t

    1. Initial program 2.9

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified2.9

      \[\leadsto \color{blue}{t \cdot \left(y \cdot \left(x - z\right)\right)}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity2.9

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

      \[\leadsto \color{blue}{1 \cdot \left(t \cdot \left(y \cdot \left(x - z\right)\right)\right)}\]
    6. Simplified3.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -5.37701967139328379 \cdot 10^{85}:\\ \;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\ \mathbf{elif}\;t \le 2.0780664373971253 \cdot 10^{-22}:\\ \;\;\;\;1 \cdot \left(\left(\left(x - z\right) \cdot t\right) \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\left(x - z\right) \cdot \left(t \cdot y\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020027 +o rules:numerics
(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))