Average Error: 10.6 → 0.6
Time: 15.5s
Precision: binary64
\[x + \frac{\left(y - z\right) \cdot t}{a - z} \]
\[\begin{array}{l} t_1 := \frac{z}{a - z}\\ t_2 := t \cdot t_1\\ t_3 := \frac{\left(y - z\right) \cdot t}{a - z}\\ \mathbf{if}\;t_3 \leq -1.434595622850509 \cdot 10^{+210}:\\ \;\;\;\;\left(t \cdot \frac{y}{a - z} - t_2\right) + x\\ \mathbf{elif}\;t_3 \leq 3.123290212595791 \cdot 10^{+224}:\\ \;\;\;\;x + \left(\frac{y \cdot t}{a - z} - t_2\right)\\ \mathbf{else}:\\ \;\;\;\;x + t \cdot \left(\frac{1}{\frac{a - z}{y}} - t_1\right)\\ \end{array} \]
x + \frac{\left(y - z\right) \cdot t}{a - z}
\begin{array}{l}
t_1 := \frac{z}{a - z}\\
t_2 := t \cdot t_1\\
t_3 := \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{if}\;t_3 \leq -1.434595622850509 \cdot 10^{+210}:\\
\;\;\;\;\left(t \cdot \frac{y}{a - z} - t_2\right) + x\\

\mathbf{elif}\;t_3 \leq 3.123290212595791 \cdot 10^{+224}:\\
\;\;\;\;x + \left(\frac{y \cdot t}{a - z} - t_2\right)\\

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


\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ z (- a z))) (t_2 (* t t_1)) (t_3 (/ (* (- y z) t) (- a z))))
   (if (<= t_3 -1.434595622850509e+210)
     (+ (- (* t (/ y (- a z))) t_2) x)
     (if (<= t_3 3.123290212595791e+224)
       (+ x (- (/ (* y t) (- a z)) t_2))
       (+ x (* t (- (/ 1.0 (/ (- a z) y)) t_1)))))))
double code(double x, double y, double z, double t, double a) {
	return x + (((y - z) * t) / (a - z));
}
double code(double x, double y, double z, double t, double a) {
	double t_1 = z / (a - z);
	double t_2 = t * t_1;
	double t_3 = ((y - z) * t) / (a - z);
	double tmp;
	if (t_3 <= -1.434595622850509e+210) {
		tmp = ((t * (y / (a - z))) - t_2) + x;
	} else if (t_3 <= 3.123290212595791e+224) {
		tmp = x + (((y * t) / (a - z)) - t_2);
	} else {
		tmp = x + (t * ((1.0 / ((a - z) / y)) - t_1));
	}
	return tmp;
}

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.6
Target0.6
Herbie0.6
\[\begin{array}{l} \mathbf{if}\;t < -1.0682974490174067 \cdot 10^{-39}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \mathbf{elif}\;t < 3.9110949887586375 \cdot 10^{-141}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \end{array} \]

Derivation

  1. Split input into 3 regimes
  2. if (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < -1.4345956228505089e210

    1. Initial program 49.4

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t}{a - z}, x\right)} \]
    3. Applied fma-udef_binary644.3

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

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

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

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

      \[\leadsto t \cdot \color{blue}{\left(\sqrt[3]{{\left(\frac{y}{a - z}\right)}^{3}} + \left(-\frac{z}{a - z}\right)\right)} + x \]
    8. Applied distribute-rgt-in_binary6410.1

      \[\leadsto \color{blue}{\left(\sqrt[3]{{\left(\frac{y}{a - z}\right)}^{3}} \cdot t + \left(-\frac{z}{a - z}\right) \cdot t\right)} + x \]
    9. Simplified1.9

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

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

    if -1.4345956228505089e210 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < 3.123290212595791e224

    1. Initial program 0.2

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t}{a - z}, x\right)} \]
    3. Applied fma-udef_binary643.0

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

      \[\leadsto \color{blue}{t \cdot \left(\frac{y}{a - z} - \frac{z}{a - z}\right)} + x \]
    5. Applied sub-neg_binary641.2

      \[\leadsto t \cdot \color{blue}{\left(\frac{y}{a - z} + \left(-\frac{z}{a - z}\right)\right)} + x \]
    6. Applied distribute-rgt-in_binary641.2

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

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

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

    if 3.123290212595791e224 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z))

    1. Initial program 51.2

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(y - z\right) \cdot t}{a - z} \leq -1.434595622850509 \cdot 10^{+210}:\\ \;\;\;\;\left(t \cdot \frac{y}{a - z} - t \cdot \frac{z}{a - z}\right) + x\\ \mathbf{elif}\;\frac{\left(y - z\right) \cdot t}{a - z} \leq 3.123290212595791 \cdot 10^{+224}:\\ \;\;\;\;x + \left(\frac{y \cdot t}{a - z} - t \cdot \frac{z}{a - z}\right)\\ \mathbf{else}:\\ \;\;\;\;x + t \cdot \left(\frac{1}{\frac{a - z}{y}} - \frac{z}{a - z}\right)\\ \end{array} \]

Reproduce

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

  :herbie-target
  (if (< t -1.0682974490174067e-39) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t))))

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