Average Error: 10.4 → 0.9
Time: 4.9s
Precision: binary64
\[x + \frac{y \cdot \left(z - t\right)}{a - t} \]
\[\begin{array}{l} \mathbf{if}\;y \leq -8.181875273801221 \cdot 10^{+64} \lor \neg \left(y \leq 3.208986056831293 \cdot 10^{-122}\right):\\ \;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{a - t}, x\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a - t}\\ \end{array} \]
x + \frac{y \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;y \leq -8.181875273801221 \cdot 10^{+64} \lor \neg \left(y \leq 3.208986056831293 \cdot 10^{-122}\right):\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{a - t}, x\right)\\

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


\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- a t))))
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= y -8.181875273801221e+64) (not (<= y 3.208986056831293e-122)))
   (fma y (/ (- z t) (- a t)) x)
   (+ x (/ (* y (- z t)) (- a t)))))
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 tmp;
	if ((y <= -8.181875273801221e+64) || !(y <= 3.208986056831293e-122)) {
		tmp = fma(y, ((z - t) / (a - t)), x);
	} else {
		tmp = x + ((y * (z - t)) / (a - t));
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

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

Derivation

  1. Split input into 2 regimes
  2. if y < -8.1818752738012213e64 or 3.208986056831293e-122 < y

    1. Initial program 19.4

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{z - t}{a - t}, x\right)} \]

    if -8.1818752738012213e64 < y < 3.208986056831293e-122

    1. Initial program 0.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.181875273801221 \cdot 10^{+64} \lor \neg \left(y \leq 3.208986056831293 \cdot 10^{-122}\right):\\ \;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{a - t}, x\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a - t}\\ \end{array} \]

Reproduce

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

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

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