Average Error: 6.8 → 2.6
Time: 8.1s
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 r9515778 = x;
        double r9515779 = y;
        double r9515780 = r9515778 * r9515779;
        double r9515781 = z;
        double r9515782 = r9515781 * r9515779;
        double r9515783 = r9515780 - r9515782;
        double r9515784 = t;
        double r9515785 = r9515783 * r9515784;
        return r9515785;
}

double f(double x, double y, double z, double t) {
        double r9515786 = t;
        double r9515787 = -1.6807852889324577e+33;
        bool r9515788 = r9515786 <= r9515787;
        double r9515789 = y;
        double r9515790 = r9515786 * r9515789;
        double r9515791 = x;
        double r9515792 = z;
        double r9515793 = r9515791 - r9515792;
        double r9515794 = r9515790 * r9515793;
        double r9515795 = 2.5769670296034863e+29;
        bool r9515796 = r9515786 <= r9515795;
        double r9515797 = r9515793 * r9515786;
        double r9515798 = r9515797 * r9515789;
        double r9515799 = r9515796 ? r9515798 : r9515794;
        double r9515800 = r9515788 ? r9515794 : r9515799;
        return r9515800;
}

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 
(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))