Average Error: 2.0 → 2.0
Time: 3.3s
Precision: binary64
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
\[\begin{array}{l} \mathbf{if}\;x \leq -6.876263184564786 \cdot 10^{+71} \lor \neg \left(x \leq 1.0215699845099448 \cdot 10^{-138}\right):\\ \;\;\;\;t + \frac{x}{\frac{y}{z - t}}\\ \mathbf{else}:\\ \;\;\;\;t + \frac{x \cdot \left(z - t\right)}{y}\\ \end{array}\]
\frac{x}{y} \cdot \left(z - t\right) + t
\begin{array}{l}
\mathbf{if}\;x \leq -6.876263184564786 \cdot 10^{+71} \lor \neg \left(x \leq 1.0215699845099448 \cdot 10^{-138}\right):\\
\;\;\;\;t + \frac{x}{\frac{y}{z - t}}\\

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

\end{array}
(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
(FPCore (x y z t)
 :precision binary64
 (if (or (<= x -6.876263184564786e+71) (not (<= x 1.0215699845099448e-138)))
   (+ t (/ x (/ y (- z t))))
   (+ t (/ (* x (- z t)) y))))
double code(double x, double y, double z, double t) {
	return ((double) (((double) ((x / y) * ((double) (z - t)))) + t));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if (((x <= -6.876263184564786e+71) || !(x <= 1.0215699845099448e-138))) {
		VAR = ((double) (t + (x / (y / ((double) (z - t))))));
	} else {
		VAR = ((double) (t + (((double) (x * ((double) (z - t)))) / y)));
	}
	return VAR;
}

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

Original2.0
Target2.3
Herbie2.0
\[\begin{array}{l} \mathbf{if}\;z < 2.759456554562692 \cdot 10^{-282}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \mathbf{elif}\;z < 2.326994450874436 \cdot 10^{-110}:\\ \;\;\;\;x \cdot \frac{z - t}{y} + t\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -6.8762631845647861e71 or 1.0215699845099448e-138 < x

    1. Initial program 3.3

      \[\frac{x}{y} \cdot \left(z - t\right) + t\]
    2. Using strategy rm
    3. Applied associate-*l/12.8

      \[\leadsto \color{blue}{\frac{x \cdot \left(z - t\right)}{y}} + t\]
    4. Using strategy rm
    5. Applied associate-/l*2.7

      \[\leadsto \color{blue}{\frac{x}{\frac{y}{z - t}}} + t\]

    if -6.8762631845647861e71 < x < 1.0215699845099448e-138

    1. Initial program 1.0

      \[\frac{x}{y} \cdot \left(z - t\right) + t\]
    2. Using strategy rm
    3. Applied associate-*l/1.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.876263184564786 \cdot 10^{+71} \lor \neg \left(x \leq 1.0215699845099448 \cdot 10^{-138}\right):\\ \;\;\;\;t + \frac{x}{\frac{y}{z - t}}\\ \mathbf{else}:\\ \;\;\;\;t + \frac{x \cdot \left(z - t\right)}{y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020198 
(FPCore (x y z t)
  :name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
  :precision binary64

  :herbie-target
  (if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))

  (+ (* (/ x y) (- z t)) t))