Average Error: 6.5 → 1.5
Time: 13.8s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -4.910837465558025 \cdot 10^{+303}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 3.08349659668913 \cdot 10^{+191}:\\ \;\;\;\;t \cdot \left(x \cdot y - z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t \cdot \left(x - z\right)\right) \cdot y\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot y \le -4.910837465558025 \cdot 10^{+303}:\\
\;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\

\mathbf{elif}\;x \cdot y - z \cdot y \le 3.08349659668913 \cdot 10^{+191}:\\
\;\;\;\;t \cdot \left(x \cdot y - z \cdot y\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r22118814 = x;
        double r22118815 = y;
        double r22118816 = r22118814 * r22118815;
        double r22118817 = z;
        double r22118818 = r22118817 * r22118815;
        double r22118819 = r22118816 - r22118818;
        double r22118820 = t;
        double r22118821 = r22118819 * r22118820;
        return r22118821;
}

double f(double x, double y, double z, double t) {
        double r22118822 = x;
        double r22118823 = y;
        double r22118824 = r22118822 * r22118823;
        double r22118825 = z;
        double r22118826 = r22118825 * r22118823;
        double r22118827 = r22118824 - r22118826;
        double r22118828 = -4.910837465558025e+303;
        bool r22118829 = r22118827 <= r22118828;
        double r22118830 = r22118822 - r22118825;
        double r22118831 = t;
        double r22118832 = r22118823 * r22118831;
        double r22118833 = r22118830 * r22118832;
        double r22118834 = 3.08349659668913e+191;
        bool r22118835 = r22118827 <= r22118834;
        double r22118836 = r22118831 * r22118827;
        double r22118837 = r22118831 * r22118830;
        double r22118838 = r22118837 * r22118823;
        double r22118839 = r22118835 ? r22118836 : r22118838;
        double r22118840 = r22118829 ? r22118833 : r22118839;
        return r22118840;
}

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.5
Target3.0
Herbie1.5
\[\begin{array}{l} \mathbf{if}\;t \lt -9.231879582886777 \cdot 10^{-80}:\\ \;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;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 3 regimes
  2. if (- (* x y) (* z y)) < -4.910837465558025e+303

    1. Initial program 56.8

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Taylor expanded around inf 56.8

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

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

    if -4.910837465558025e+303 < (- (* x y) (* z y)) < 3.08349659668913e+191

    1. Initial program 1.6

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]

    if 3.08349659668913e+191 < (- (* x y) (* z y))

    1. Initial program 26.1

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Using strategy rm
    3. Applied distribute-rgt-out--26.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -4.910837465558025 \cdot 10^{+303}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 3.08349659668913 \cdot 10^{+191}:\\ \;\;\;\;t \cdot \left(x \cdot y - z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t \cdot \left(x - z\right)\right) \cdot y\\ \end{array}\]

Reproduce

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