Average Error: 6.9 → 1.8
Time: 11.4s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -7.222093090430865854846214223753387413719 \cdot 10^{176} \lor \neg \left(x \cdot y - z \cdot y \le 5.372101420387125971810690231338819728234 \cdot 10^{161}\right):\\ \;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot y \le -7.222093090430865854846214223753387413719 \cdot 10^{176} \lor \neg \left(x \cdot y - z \cdot y \le 5.372101420387125971810690231338819728234 \cdot 10^{161}\right):\\
\;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r617295 = x;
        double r617296 = y;
        double r617297 = r617295 * r617296;
        double r617298 = z;
        double r617299 = r617298 * r617296;
        double r617300 = r617297 - r617299;
        double r617301 = t;
        double r617302 = r617300 * r617301;
        return r617302;
}

double f(double x, double y, double z, double t) {
        double r617303 = x;
        double r617304 = y;
        double r617305 = r617303 * r617304;
        double r617306 = z;
        double r617307 = r617306 * r617304;
        double r617308 = r617305 - r617307;
        double r617309 = -7.222093090430866e+176;
        bool r617310 = r617308 <= r617309;
        double r617311 = 5.372101420387126e+161;
        bool r617312 = r617308 <= r617311;
        double r617313 = !r617312;
        bool r617314 = r617310 || r617313;
        double r617315 = t;
        double r617316 = r617315 * r617304;
        double r617317 = r617303 - r617306;
        double r617318 = r617316 * r617317;
        double r617319 = r617308 * r617315;
        double r617320 = r617314 ? r617318 : r617319;
        return r617320;
}

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.9
Target2.9
Herbie1.8
\[\begin{array}{l} \mathbf{if}\;t \lt -9.231879582886776938073886590448747944753 \cdot 10^{-80}:\\ \;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;t \lt 2.543067051564877116200336808272775217995 \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)) < -7.222093090430866e+176 or 5.372101420387126e+161 < (- (* x y) (* z y))

    1. Initial program 22.7

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

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

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

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

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

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

    if -7.222093090430866e+176 < (- (* x y) (* z y)) < 5.372101420387126e+161

    1. Initial program 1.8

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -7.222093090430865854846214223753387413719 \cdot 10^{176} \lor \neg \left(x \cdot y - z \cdot y \le 5.372101420387125971810690231338819728234 \cdot 10^{161}\right):\\ \;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \end{array}\]

Reproduce

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