Average Error: 10.4 → 1.3
Time: 2.9s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
\[\begin{array}{l} \mathbf{if}\;z \le -9.99905195886523696 \cdot 10^{-146} \lor \neg \left(z \le 2.6902497134281926 \cdot 10^{-142}\right):\\ \;\;\;\;\frac{z - t}{z - a} \cdot y + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{z - a}, z - t, x\right)\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{z - a}
\begin{array}{l}
\mathbf{if}\;z \le -9.99905195886523696 \cdot 10^{-146} \lor \neg \left(z \le 2.6902497134281926 \cdot 10^{-142}\right):\\
\;\;\;\;\frac{z - t}{z - a} \cdot y + x\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z - a}, z - t, x\right)\\

\end{array}
double code(double x, double y, double z, double t, double a) {
	return (x + ((y * (z - t)) / (z - a)));
}
double code(double x, double y, double z, double t, double a) {
	double VAR;
	if (((z <= -9.999051958865237e-146) || !(z <= 2.6902497134281926e-142))) {
		VAR = ((((z - t) / (z - a)) * y) + x);
	} else {
		VAR = fma((y / (z - a)), (z - t), x);
	}
	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

Original10.4
Target1.2
Herbie1.3
\[x + \frac{y}{\frac{z - a}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -9.999051958865237e-146 or 2.6902497134281926e-142 < z

    1. Initial program 12.7

      \[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
    2. Simplified2.8

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z - a}, z - t, x\right)}\]
    3. Using strategy rm
    4. Applied clear-num3.1

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{\frac{z - a}{y}}}, z - t, x\right)\]
    5. Using strategy rm
    6. Applied fma-udef3.1

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

      \[\leadsto \color{blue}{\frac{z - t}{\frac{z - a}{y}}} + x\]
    8. Using strategy rm
    9. Applied associate-/r/0.5

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

    if -9.999051958865237e-146 < z < 2.6902497134281926e-142

    1. Initial program 3.3

      \[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
    2. Simplified3.9

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z - a}, z - t, x\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -9.99905195886523696 \cdot 10^{-146} \lor \neg \left(z \le 2.6902497134281926 \cdot 10^{-142}\right):\\ \;\;\;\;\frac{z - t}{z - a} \cdot y + x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{z - a}, z - t, x\right)\\ \end{array}\]

Reproduce

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

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

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