Average Error: 7.1 → 0.5
Time: 2.2s
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.28824894235068545 \cdot 10^{303}:\\ \;\;\;\;\left(t \cdot y\right) \cdot x + \left(t \cdot y\right) \cdot \left(-z\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -8.41323561650887991 \cdot 10^{-226}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 2.2008785951948148 \cdot 10^{-166}:\\ \;\;\;\;\left(t \cdot y\right) \cdot x + \left(t \cdot y\right) \cdot \left(-z\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 6.61588088234635616 \cdot 10^{208}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \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.28824894235068545 \cdot 10^{303}:\\
\;\;\;\;\left(t \cdot y\right) \cdot x + \left(t \cdot y\right) \cdot \left(-z\right)\\

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

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

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r522103 = x;
        double r522104 = y;
        double r522105 = r522103 * r522104;
        double r522106 = z;
        double r522107 = r522106 * r522104;
        double r522108 = r522105 - r522107;
        double r522109 = t;
        double r522110 = r522108 * r522109;
        return r522110;
}

double f(double x, double y, double z, double t) {
        double r522111 = x;
        double r522112 = y;
        double r522113 = r522111 * r522112;
        double r522114 = z;
        double r522115 = r522114 * r522112;
        double r522116 = r522113 - r522115;
        double r522117 = -4.2882489423506854e+303;
        bool r522118 = r522116 <= r522117;
        double r522119 = t;
        double r522120 = r522119 * r522112;
        double r522121 = r522120 * r522111;
        double r522122 = -r522114;
        double r522123 = r522120 * r522122;
        double r522124 = r522121 + r522123;
        double r522125 = -8.41323561650888e-226;
        bool r522126 = r522116 <= r522125;
        double r522127 = r522116 * r522119;
        double r522128 = 2.2008785951948148e-166;
        bool r522129 = r522116 <= r522128;
        double r522130 = 6.615880882346356e+208;
        bool r522131 = r522116 <= r522130;
        double r522132 = r522111 - r522114;
        double r522133 = r522132 * r522119;
        double r522134 = r522112 * r522133;
        double r522135 = r522131 ? r522127 : r522134;
        double r522136 = r522129 ? r522124 : r522135;
        double r522137 = r522126 ? r522127 : r522136;
        double r522138 = r522118 ? r522124 : r522137;
        return r522138;
}

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

Original7.1
Target3.1
Herbie0.5
\[\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 (- (* x y) (* z y)) < -4.2882489423506854e+303 or -8.41323561650888e-226 < (- (* x y) (* z y)) < 2.2008785951948148e-166

    1. Initial program 20.6

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

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

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

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

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

    if -4.2882489423506854e+303 < (- (* x y) (* z y)) < -8.41323561650888e-226 or 2.2008785951948148e-166 < (- (* x y) (* z y)) < 6.615880882346356e+208

    1. Initial program 0.3

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

    if 6.615880882346356e+208 < (- (* x y) (* z y))

    1. Initial program 31.1

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -4.28824894235068545 \cdot 10^{303}:\\ \;\;\;\;\left(t \cdot y\right) \cdot x + \left(t \cdot y\right) \cdot \left(-z\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -8.41323561650887991 \cdot 10^{-226}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 2.2008785951948148 \cdot 10^{-166}:\\ \;\;\;\;\left(t \cdot y\right) \cdot x + \left(t \cdot y\right) \cdot \left(-z\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 6.61588088234635616 \cdot 10^{208}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020047 +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))