Average Error: 10.3 → 1.5
Time: 2.5s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
\[\begin{array}{l} \mathbf{if}\;t \le 9.07721968675766034 \cdot 10^{-106}:\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{z - a} \cdot \left(z - t\right)\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{z - a}
\begin{array}{l}
\mathbf{if}\;t \le 9.07721968675766034 \cdot 10^{-106}:\\
\;\;\;\;x + y \cdot \frac{z - t}{z - a}\\

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

\end{array}
double code(double x, double y, double z, double t, double a) {
	return ((double) (x + ((double) (((double) (y * ((double) (z - t)))) / ((double) (z - a))))));
}
double code(double x, double y, double z, double t, double a) {
	double VAR;
	if ((t <= 9.07721968675766e-106)) {
		VAR = ((double) (x + ((double) (y * ((double) (((double) (z - t)) / ((double) (z - a))))))));
	} else {
		VAR = ((double) (x + ((double) (((double) (y / ((double) (z - a)))) * ((double) (z - 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.3
Target1.2
Herbie1.5
\[x + \frac{y}{\frac{z - a}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if t < 9.07721968675766e-106

    1. Initial program 9.8

      \[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity9.8

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

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

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

    if 9.07721968675766e-106 < t

    1. Initial program 11.4

      \[x + \frac{y \cdot \left(z - t\right)}{z - a}\]
    2. Using strategy rm
    3. Applied associate-/l*1.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le 9.07721968675766034 \cdot 10^{-106}:\\ \;\;\;\;x + y \cdot \frac{z - t}{z - a}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{z - a} \cdot \left(z - t\right)\\ \end{array}\]

Reproduce

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

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

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