Average Error: 10.5 → 0.6
Time: 3.5s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y \cdot \left(z - t\right)}{a - t} = -\infty \lor \neg \left(\frac{y \cdot \left(z - t\right)}{a - t} \le 2.4659995466975486 \cdot 10^{155}\right):\\ \;\;\;\;\frac{z - t}{a - t} \cdot y + x\\ \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}\;\frac{y \cdot \left(z - t\right)}{a - t} = -\infty \lor \neg \left(\frac{y \cdot \left(z - t\right)}{a - t} \le 2.4659995466975486 \cdot 10^{155}\right):\\
\;\;\;\;\frac{z - t}{a - t} \cdot y + x\\

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

\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 VAR;
	if (((((y * (z - t)) / (a - t)) <= -inf.0) || !(((y * (z - t)) / (a - t)) <= 2.4659995466975486e+155))) {
		VAR = ((((z - t) / (a - t)) * y) + x);
	} else {
		VAR = (x + ((y * (z - t)) / (a - t)));
	}
	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.5
Target1.3
Herbie0.6
\[x + \frac{y}{\frac{a - t}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if (/ (* y (- z t)) (- a t)) < -inf.0 or 2.4659995466975486e+155 < (/ (* y (- z t)) (- a t))

    1. Initial program 48.4

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

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

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

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

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

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

    if -inf.0 < (/ (* y (- z t)) (- a t)) < 2.4659995466975486e+155

    1. Initial program 0.2

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

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

Reproduce

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