Average Error: 6.8 → 2.6
Time: 8.7s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.6807852889324577 \cdot 10^{+33}:\\ \;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;t \le 2.5769670296034863 \cdot 10^{+29}:\\ \;\;\;\;\left(\left(x - z\right) \cdot t\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;t \le -1.6807852889324577 \cdot 10^{+33}:\\
\;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r9079354 = x;
        double r9079355 = y;
        double r9079356 = r9079354 * r9079355;
        double r9079357 = z;
        double r9079358 = r9079357 * r9079355;
        double r9079359 = r9079356 - r9079358;
        double r9079360 = t;
        double r9079361 = r9079359 * r9079360;
        return r9079361;
}

double f(double x, double y, double z, double t) {
        double r9079362 = t;
        double r9079363 = -1.6807852889324577e+33;
        bool r9079364 = r9079362 <= r9079363;
        double r9079365 = y;
        double r9079366 = r9079362 * r9079365;
        double r9079367 = x;
        double r9079368 = z;
        double r9079369 = r9079367 - r9079368;
        double r9079370 = r9079366 * r9079369;
        double r9079371 = 2.5769670296034863e+29;
        bool r9079372 = r9079362 <= r9079371;
        double r9079373 = r9079369 * r9079362;
        double r9079374 = r9079373 * r9079365;
        double r9079375 = r9079372 ? r9079374 : r9079370;
        double r9079376 = r9079364 ? r9079370 : r9079375;
        return r9079376;
}

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.8
Target3.1
Herbie2.6
\[\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 2 regimes
  2. if t < -1.6807852889324577e+33 or 2.5769670296034863e+29 < t

    1. Initial program 4.0

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified3.6

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

    if -1.6807852889324577e+33 < t < 2.5769670296034863e+29

    1. Initial program 8.2

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.6807852889324577 \cdot 10^{+33}:\\ \;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;t \le 2.5769670296034863 \cdot 10^{+29}:\\ \;\;\;\;\left(\left(x - z\right) \cdot t\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\ \end{array}\]

Reproduce

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