Average Error: 10.4 → 1.0
Time: 4.0s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.10784404302477939 \cdot 10^{84} \lor \neg \left(y \le 5.5802422866714181 \cdot 10^{-161}\right):\\ \;\;\;\;\frac{z - t}{a - t} \cdot y + x\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{a - t} \cdot \left(\left(z - t\right) \cdot y\right) + x\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;y \le -1.10784404302477939 \cdot 10^{84} \lor \neg \left(y \le 5.5802422866714181 \cdot 10^{-161}\right):\\
\;\;\;\;\frac{z - t}{a - t} \cdot y + x\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{a - t} \cdot \left(\left(z - t\right) \cdot y\right) + 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.1078440430247794e+84) || !(y <= 5.580242286671418e-161))) {
		temp = ((((z - t) / (a - t)) * y) + x);
	} else {
		temp = (((1.0 / (a - t)) * ((z - t) * y)) + 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.4
Target1.3
Herbie1.0
\[x + \frac{y}{\frac{a - t}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -1.1078440430247794e+84 or 5.580242286671418e-161 < y

    1. Initial program 18.5

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

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

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

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

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

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

    if -1.1078440430247794e+84 < y < 5.580242286671418e-161

    1. Initial program 1.4

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

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

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

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

      \[\leadsto \color{blue}{\frac{z - t}{\frac{a - t}{y}}} + x\]
    8. Using strategy rm
    9. Applied div-inv3.2

      \[\leadsto \frac{z - t}{\color{blue}{\left(a - t\right) \cdot \frac{1}{y}}} + x\]
    10. Applied *-un-lft-identity3.2

      \[\leadsto \frac{\color{blue}{1 \cdot \left(z - t\right)}}{\left(a - t\right) \cdot \frac{1}{y}} + x\]
    11. Applied times-frac1.4

      \[\leadsto \color{blue}{\frac{1}{a - t} \cdot \frac{z - t}{\frac{1}{y}}} + x\]
    12. Simplified1.4

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

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

Reproduce

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