Average Error: 1.5 → 0.9
Time: 11.9s
Precision: binary64
\[x + y \cdot \frac{z - t}{z - a}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \frac{z - t}{z - a} \le 1.70874597868709309 \cdot 10^{307}:\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\left(z - t\right) \cdot y\right) \cdot \frac{1}{z - a}\\ \end{array}\]
x + y \cdot \frac{z - t}{z - a}
\begin{array}{l}
\mathbf{if}\;y \cdot \frac{z - t}{z - a} \le 1.70874597868709309 \cdot 10^{307}:\\
\;\;\;\;x + y \cdot \frac{z - t}{z - a}\\

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

\end{array}
double code(double x, double y, double z, double t, double a) {
	return ((double) (x + ((double) (y * (((double) (z - t)) / ((double) (z - a)))))));
}
double code(double x, double y, double z, double t, double a) {
	double VAR;
	if ((((double) (y * (((double) (z - t)) / ((double) (z - a))))) <= 1.708745978687093e+307)) {
		VAR = ((double) (x + ((double) (y * (((double) (z - t)) / ((double) (z - a)))))));
	} else {
		VAR = ((double) (x + ((double) (((double) (((double) (z - t)) * y)) * (1.0 / ((double) (z - a)))))));
	}
	return VAR;
}

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.5
Target1.4
Herbie0.9
\[x + \frac{y}{\frac{z - a}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if (* y (/ (- z t) (- z a))) < 1.70874597868709309e307

    1. Initial program 0.9

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

    if 1.70874597868709309e307 < (* y (/ (- z t) (- z a)))

    1. Initial program 61.0

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

      \[\leadsto x + y \cdot \color{blue}{\left(\left(z - t\right) \cdot \frac{1}{z - a}\right)}\]
    4. Applied associate-*r*2.6

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

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

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

Reproduce

herbie shell --seed 2020182 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A"
  :precision binary64

  :herbie-target
  (+ x (/ y (/ (- z a) (- z t))))

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