Average Error: 6.8 → 0.3
Time: 3.1s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -1.1216381272031817 \cdot 10^{279}:\\ \;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -2.45676478580699958 \cdot 10^{-247}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 1.88712653588383372 \cdot 10^{-270}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 2.09756000476907307 \cdot 10^{298}:\\ \;\;\;\;\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 -1.1216381272031817 \cdot 10^{279}:\\
\;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\

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

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

\mathbf{elif}\;x \cdot y - z \cdot y \le 2.09756000476907307 \cdot 10^{298}:\\
\;\;\;\;\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 r537677 = x;
        double r537678 = y;
        double r537679 = r537677 * r537678;
        double r537680 = z;
        double r537681 = r537680 * r537678;
        double r537682 = r537679 - r537681;
        double r537683 = t;
        double r537684 = r537682 * r537683;
        return r537684;
}

double f(double x, double y, double z, double t) {
        double r537685 = x;
        double r537686 = y;
        double r537687 = r537685 * r537686;
        double r537688 = z;
        double r537689 = r537688 * r537686;
        double r537690 = r537687 - r537689;
        double r537691 = -1.1216381272031817e+279;
        bool r537692 = r537690 <= r537691;
        double r537693 = t;
        double r537694 = r537693 * r537686;
        double r537695 = r537685 - r537688;
        double r537696 = r537694 * r537695;
        double r537697 = -2.4567647858069996e-247;
        bool r537698 = r537690 <= r537697;
        double r537699 = r537690 * r537693;
        double r537700 = 1.8871265358838337e-270;
        bool r537701 = r537690 <= r537700;
        double r537702 = r537695 * r537693;
        double r537703 = r537686 * r537702;
        double r537704 = 2.097560004769073e+298;
        bool r537705 = r537690 <= r537704;
        double r537706 = r537705 ? r537699 : r537703;
        double r537707 = r537701 ? r537703 : r537706;
        double r537708 = r537698 ? r537699 : r537707;
        double r537709 = r537692 ? r537696 : r537708;
        return r537709;
}

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.0
Herbie0.3
\[\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)) < -1.1216381272031817e+279

    1. Initial program 47.3

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

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

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

    if -1.1216381272031817e+279 < (- (* x y) (* z y)) < -2.4567647858069996e-247 or 1.8871265358838337e-270 < (- (* x y) (* z y)) < 2.097560004769073e+298

    1. Initial program 0.2

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

    if -2.4567647858069996e-247 < (- (* x y) (* z y)) < 1.8871265358838337e-270 or 2.097560004769073e+298 < (- (* x y) (* z y))

    1. Initial program 30.6

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -1.1216381272031817 \cdot 10^{279}:\\ \;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -2.45676478580699958 \cdot 10^{-247}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 1.88712653588383372 \cdot 10^{-270}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 2.09756000476907307 \cdot 10^{298}:\\ \;\;\;\;\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 2020046 +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))