Average Error: 1.4 → 0.5
Time: 4.5s
Precision: 64
\[x + y \cdot \frac{z - t}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;y \le -6.2914023978356098 \cdot 10^{35} \lor \neg \left(y \le 8.8693386644516809 \cdot 10^{-85}\right):\\ \;\;\;\;x + \frac{z - t}{a - t} \cdot y\\ \mathbf{else}:\\ \;\;\;\;x + 1 \cdot \frac{\left(z - t\right) \cdot y}{a - t}\\ \end{array}\]
x + y \cdot \frac{z - t}{a - t}
\begin{array}{l}
\mathbf{if}\;y \le -6.2914023978356098 \cdot 10^{35} \lor \neg \left(y \le 8.8693386644516809 \cdot 10^{-85}\right):\\
\;\;\;\;x + \frac{z - t}{a - t} \cdot y\\

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

\end{array}
double code(double x, double y, double z, double t, double a) {
	return (x + (y * ((z - t) / (a - t))));
}
double code(double x, double y, double z, double t, double a) {
	double temp;
	if (((y <= -6.29140239783561e+35) || !(y <= 8.869338664451681e-85))) {
		temp = (x + (((z - t) / (a - t)) * y));
	} else {
		temp = (x + (1.0 * (((z - t) * y) / (a - t))));
	}
	return temp;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original1.4
Target0.4
Herbie0.5
\[\begin{array}{l} \mathbf{if}\;y \lt -8.50808486055124107 \cdot 10^{-17}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;y \lt 2.8944268627920891 \cdot 10^{-49}:\\ \;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -6.29140239783561e+35 or 8.869338664451681e-85 < y

    1. Initial program 0.5

      \[x + y \cdot \frac{z - t}{a - t}\]
    2. Using strategy rm
    3. Applied *-commutative0.5

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

    if -6.29140239783561e+35 < y < 8.869338664451681e-85

    1. Initial program 2.3

      \[x + y \cdot \frac{z - t}{a - t}\]
    2. Using strategy rm
    3. Applied *-commutative2.3

      \[\leadsto x + \color{blue}{\frac{z - t}{a - t} \cdot y}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity2.3

      \[\leadsto x + \frac{z - t}{\color{blue}{1 \cdot \left(a - t\right)}} \cdot y\]
    6. Applied add-cube-cbrt2.6

      \[\leadsto x + \frac{\color{blue}{\left(\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}\right) \cdot \sqrt[3]{z - t}}}{1 \cdot \left(a - t\right)} \cdot y\]
    7. Applied times-frac2.6

      \[\leadsto x + \color{blue}{\left(\frac{\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}}{1} \cdot \frac{\sqrt[3]{z - t}}{a - t}\right)} \cdot y\]
    8. Applied associate-*l*1.9

      \[\leadsto x + \color{blue}{\frac{\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}}{1} \cdot \left(\frac{\sqrt[3]{z - t}}{a - t} \cdot y\right)}\]
    9. Using strategy rm
    10. Applied *-un-lft-identity1.9

      \[\leadsto x + \color{blue}{\left(1 \cdot \frac{\sqrt[3]{z - t} \cdot \sqrt[3]{z - t}}{1}\right)} \cdot \left(\frac{\sqrt[3]{z - t}}{a - t} \cdot y\right)\]
    11. Applied associate-*l*1.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -6.2914023978356098 \cdot 10^{35} \lor \neg \left(y \le 8.8693386644516809 \cdot 10^{-85}\right):\\ \;\;\;\;x + \frac{z - t}{a - t} \cdot y\\ \mathbf{else}:\\ \;\;\;\;x + 1 \cdot \frac{\left(z - t\right) \cdot y}{a - t}\\ \end{array}\]

Reproduce

herbie shell --seed 2020049 +o rules:numerics
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
  :precision binary64

  :herbie-target
  (if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))

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