Average Error: 1.9 → 1.2
Time: 4.4s
Precision: 64
\[\frac{x}{y} \cdot \left(z - t\right) + t\]
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \cdot \left(z - t\right) + t = -\infty:\\ \;\;\;\;{\left(\frac{x}{\frac{y}{z - t}}\right)}^{1} + t\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \end{array}\]
\frac{x}{y} \cdot \left(z - t\right) + t
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \cdot \left(z - t\right) + t = -\infty:\\
\;\;\;\;{\left(\frac{x}{\frac{y}{z - t}}\right)}^{1} + t\\

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

\end{array}
double code(double x, double y, double z, double t) {
	return ((double) (((double) (((double) (x / y)) * ((double) (z - t)))) + t));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if ((((double) (((double) (((double) (x / y)) * ((double) (z - t)))) + t)) <= -inf.0)) {
		VAR = ((double) (((double) pow(((double) (x / ((double) (y / ((double) (z - t)))))), 1.0)) + t));
	} else {
		VAR = ((double) (((double) (((double) (x / y)) * ((double) (z - t)))) + t));
	}
	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

Original1.9
Target2.2
Herbie1.2
\[\begin{array}{l} \mathbf{if}\;z \lt 2.7594565545626922 \cdot 10^{-282}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \mathbf{elif}\;z \lt 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 y) (- z t)) t) < -inf.0

    1. Initial program 64.0

      \[\frac{x}{y} \cdot \left(z - t\right) + t\]
    2. Using strategy rm
    3. Applied pow164.0

      \[\leadsto \frac{x}{y} \cdot \color{blue}{{\left(z - t\right)}^{1}} + t\]
    4. Applied pow164.0

      \[\leadsto \color{blue}{{\left(\frac{x}{y}\right)}^{1}} \cdot {\left(z - t\right)}^{1} + t\]
    5. Applied pow-prod-down64.0

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

      \[\leadsto {\color{blue}{\left(\frac{\left(z - t\right) \cdot x}{y}\right)}}^{1} + t\]
    7. Using strategy rm
    8. Applied *-commutative0.3

      \[\leadsto {\left(\frac{\color{blue}{x \cdot \left(z - t\right)}}{y}\right)}^{1} + t\]
    9. Applied associate-/l*0.3

      \[\leadsto {\color{blue}{\left(\frac{x}{\frac{y}{z - t}}\right)}}^{1} + t\]

    if -inf.0 < (+ (* (/ x y) (- z t)) t)

    1. Initial program 1.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \cdot \left(z - t\right) + t = -\infty:\\ \;\;\;\;{\left(\frac{x}{\frac{y}{z - t}}\right)}^{1} + t\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \end{array}\]

Reproduce

herbie shell --seed 2020114 +o rules:numerics
(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))