Average Error: 6.9 → 2.9
Time: 5.7s
Precision: binary64
Cost: 1032
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;t \leq -1.0358517492678618 \cdot 10^{+96} \lor \neg \left(t \leq 1.8279941513435347 \cdot 10^{-47}\right):\\ \;\;\;\;\left(x - z\right) \cdot \left(t \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t \cdot x\right) - y \cdot \left(t \cdot z\right)\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;t \leq -1.0358517492678618 \cdot 10^{+96} \lor \neg \left(t \leq 1.8279941513435347 \cdot 10^{-47}\right):\\
\;\;\;\;\left(x - z\right) \cdot \left(t \cdot y\right)\\

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

\end{array}
(FPCore (x y z t) :precision binary64 (* (- (* x y) (* z y)) t))
(FPCore (x y z t)
 :precision binary64
 (if (or (<= t -1.0358517492678618e+96) (not (<= t 1.8279941513435347e-47)))
   (* (- x z) (* t y))
   (- (* y (* t x)) (* y (* t z)))))
double code(double x, double y, double z, double t) {
	return ((x * y) - (z * y)) * t;
}
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -1.0358517492678618e+96) || !(t <= 1.8279941513435347e-47)) {
		tmp = (x - z) * (t * y);
	} else {
		tmp = (y * (t * x)) - (y * (t * z));
	}
	return tmp;
}

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.8
Herbie2.9
\[\begin{array}{l} \mathbf{if}\;t < -9.231879582886777 \cdot 10^{-80}:\\ \;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;t < 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}\]

Alternatives

Alternative 1
Error2.9
Cost776
\[\begin{array}{l} \mathbf{if}\;t \leq -4.098859952306187 \cdot 10^{+96} \lor \neg \left(t \leq 1.9391183994431827 \cdot 10^{-45}\right):\\ \;\;\;\;\left(x - z\right) \cdot \left(t \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \end{array}\]
Alternative 2
Error7.2
Cost776
\[\begin{array}{l} \mathbf{if}\;y \leq -3.291179724615573 \cdot 10^{-229} \lor \neg \left(y \leq -9.436019428721827 \cdot 10^{-272}\right):\\ \;\;\;\;\left(x - z\right) \cdot \left(t \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \end{array}\]
Alternative 3
Error19.9
Cost1668
\[\begin{array}{l} \mathbf{if}\;x \leq -3.2813222293686855 \cdot 10^{-56}:\\ \;\;\;\;y \cdot \left(t \cdot x\right)\\ \mathbf{elif}\;x \leq 2.560254472377094 \cdot 10^{-44}:\\ \;\;\;\;t \cdot \left(y \cdot \left(-z\right)\right)\\ \mathbf{elif}\;x \leq 18570506605.354034:\\ \;\;\;\;y \cdot \left(t \cdot x\right)\\ \mathbf{elif}\;x \leq 9.361864281684967 \cdot 10^{+97}:\\ \;\;\;\;y \cdot \left(t \cdot \left(-z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t \cdot y\right)\\ \end{array}\]
Alternative 4
Error20.0
Cost1668
\[\begin{array}{l} \mathbf{if}\;x \leq -3.720673049585814 \cdot 10^{-56}:\\ \;\;\;\;y \cdot \left(t \cdot x\right)\\ \mathbf{elif}\;x \leq 6.159543184306834 \cdot 10^{-65}:\\ \;\;\;\;\left(t \cdot y\right) \cdot \left(-z\right)\\ \mathbf{elif}\;x \leq 8628286400.02778:\\ \;\;\;\;y \cdot \left(t \cdot x\right)\\ \mathbf{elif}\;x \leq 9.361864281684967 \cdot 10^{+97}:\\ \;\;\;\;y \cdot \left(t \cdot \left(-z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t \cdot y\right)\\ \end{array}\]
Alternative 5
Error19.7
Cost1668
\[\begin{array}{l} \mathbf{if}\;x \leq -2.452726806680466 \cdot 10^{-56}:\\ \;\;\;\;y \cdot \left(t \cdot x\right)\\ \mathbf{elif}\;x \leq 3.0196792545312414 \cdot 10^{-64}:\\ \;\;\;\;y \cdot \left(t \cdot \left(-z\right)\right)\\ \mathbf{elif}\;x \leq 32440858847.327892:\\ \;\;\;\;y \cdot \left(t \cdot x\right)\\ \mathbf{elif}\;x \leq 1.6079895944916527 \cdot 10^{+99}:\\ \;\;\;\;y \cdot \left(t \cdot \left(-z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t \cdot y\right)\\ \end{array}\]
Alternative 6
Error29.9
Cost641
\[\begin{array}{l} \mathbf{if}\;t \leq 1.347308895368109 \cdot 10^{-42}:\\ \;\;\;\;y \cdot \left(t \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(t \cdot y\right)\\ \end{array}\]
Alternative 7
Error30.0
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -1.5901320942153635 \cdot 10^{+140} \lor \neg \left(y \leq 8.98581219630675 \cdot 10^{-293}\right):\\ \;\;\;\;x \cdot \left(t \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \end{array}\]
Alternative 8
Error30.9
Cost320
\[x \cdot \left(t \cdot y\right)\]
Alternative 9
Error54.9
Cost64
\[0\]
Alternative 10
Error61.7
Cost64
\[1\]

Error

Derivation

  1. Split input into 2 regimes
  2. if t < -1.0358517492678618e96 or 1.8279941513435347e-47 < t

    1. Initial program 3.5

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified15.3

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

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

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

    if -1.0358517492678618e96 < t < 1.8279941513435347e-47

    1. Initial program 8.8

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified2.3

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

      \[\leadsto y \cdot \left(t \cdot \color{blue}{\left(x + \left(-z\right)\right)}\right)\]
    5. Applied distribute-rgt-in_binary64_99172.3

      \[\leadsto y \cdot \color{blue}{\left(x \cdot t + \left(-z\right) \cdot t\right)}\]
    6. Applied distribute-rgt-in_binary64_99172.3

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.0358517492678618 \cdot 10^{+96} \lor \neg \left(t \leq 1.8279941513435347 \cdot 10^{-47}\right):\\ \;\;\;\;\left(x - z\right) \cdot \left(t \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t \cdot x\right) - y \cdot \left(t \cdot z\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2021044 
(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))