Average Error: 10.9 → 1.5
Time: 6.9s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.0071455594193599 \cdot 10^{-271} \lor \neg \left(t \le 8.49657610056407139 \cdot 10^{-71}\right):\\ \;\;\;\;y \cdot \left(\frac{z}{a - t} - \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{t}{a - t}\right)\right)\right) + x\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \left(z - t\right)}{a - t} + x\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;t \le -1.0071455594193599 \cdot 10^{-271} \lor \neg \left(t \le 8.49657610056407139 \cdot 10^{-71}\right):\\
\;\;\;\;y \cdot \left(\frac{z}{a - t} - \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{t}{a - t}\right)\right)\right) + x\\

\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(z - t\right)}{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 (((t <= -1.0071455594193599e-271) || !(t <= 8.496576100564071e-71))) {
		temp = ((y * ((z / (a - t)) - log1p(expm1((t / (a - t)))))) + x);
	} else {
		temp = (((y * (z - t)) / (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.3
Herbie1.5
\[x + \frac{y}{\frac{a - t}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if t < -1.0071455594193599e-271 or 8.496576100564071e-71 < t

    1. Initial program 12.7

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

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

      \[\leadsto \color{blue}{\frac{y}{a - t} \cdot \left(z - t\right) + x}\]
    5. Using strategy rm
    6. Applied div-inv2.9

      \[\leadsto \color{blue}{\left(y \cdot \frac{1}{a - t}\right)} \cdot \left(z - t\right) + x\]
    7. Applied associate-*l*0.9

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

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

      \[\leadsto y \cdot \color{blue}{\left(\frac{z}{a - t} - \frac{t}{a - t}\right)} + x\]
    11. Using strategy rm
    12. Applied log1p-expm1-u0.9

      \[\leadsto y \cdot \left(\frac{z}{a - t} - \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{t}{a - t}\right)\right)}\right) + x\]

    if -1.0071455594193599e-271 < t < 8.496576100564071e-71

    1. Initial program 3.8

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

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

      \[\leadsto \color{blue}{\frac{y}{a - t} \cdot \left(z - t\right) + x}\]
    5. Using strategy rm
    6. Applied div-inv3.5

      \[\leadsto \color{blue}{\left(y \cdot \frac{1}{a - t}\right)} \cdot \left(z - t\right) + x\]
    7. Applied associate-*l*3.5

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.0071455594193599 \cdot 10^{-271} \lor \neg \left(t \le 8.49657610056407139 \cdot 10^{-71}\right):\\ \;\;\;\;y \cdot \left(\frac{z}{a - t} - \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{t}{a - t}\right)\right)\right) + x\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \left(z - t\right)}{a - t} + x\\ \end{array}\]

Reproduce

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