Average Error: 10.9 → 0.8
Time: 4.2s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.67441263003196253 \cdot 10^{-50} \lor \neg \left(y \le 1.8254784728229986 \cdot 10^{-242}\right):\\ \;\;\;\;\frac{z - t}{a - t} \cdot y + x\\ \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 -1.67441263003196253 \cdot 10^{-50} \lor \neg \left(y \le 1.8254784728229986 \cdot 10^{-242}\right):\\
\;\;\;\;\frac{z - t}{a - t} \cdot y + x\\

\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 <= -1.6744126300319625e-50) || !(y <= 1.8254784728229986e-242))) {
		temp = ((((z - t) / (a - t)) * y) + 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.9
Target1.4
Herbie0.8
\[x + \frac{y}{\frac{a - t}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -1.6744126300319625e-50 or 1.8254784728229986e-242 < y

    1. Initial program 15.1

      \[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)}\]
    3. Using strategy rm
    4. Applied clear-num2.9

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

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

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

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

    if -1.6744126300319625e-50 < y < 1.8254784728229986e-242

    1. Initial program 0.4

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{z - t}{a - t} \cdot y} + x\]
    10. Using strategy rm
    11. Applied associate-*l/0.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.67441263003196253 \cdot 10^{-50} \lor \neg \left(y \le 1.8254784728229986 \cdot 10^{-242}\right):\\ \;\;\;\;\frac{z - t}{a - t} \cdot y + x\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(z - t\right) \cdot y}{a - t} + x\\ \end{array}\]

Reproduce

herbie shell --seed 2020058 +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))))