Average Error: 10.8 → 1.8
Time: 5.4s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.7620314914513706 \cdot 10^{-14} \lor \neg \left(y \le 3.8207927840147822 \cdot 10^{-149}\right):\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{a - t}, z - t, x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(z - t\right) \cdot y}{a - t} + x\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;y \le -2.7620314914513706 \cdot 10^{-14} \lor \neg \left(y \le 3.8207927840147822 \cdot 10^{-149}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a - t}, z - t, x\right)\\

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

\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 <= -2.7620314914513706e-14) || !(y <= 3.820792784014782e-149))) {
		temp = fma((y / (a - t)), (z - t), x);
	} else {
		temp = ((((z - t) * y) / (a - t)) + x);
	}
	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

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

Derivation

  1. Split input into 2 regimes
  2. if y < -2.7620314914513706e-14 or 3.820792784014782e-149 < y

    1. Initial program 17.6

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

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

    if -2.7620314914513706e-14 < y < 3.820792784014782e-149

    1. Initial program 0.4

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

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

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

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

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

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

Reproduce

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