Average Error: 24.6 → 8.2
Time: 22.8s
Precision: binary64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq -\infty:\\ \;\;\;\;\left(y - z\right) \cdot \frac{t}{a - z}\\ \mathbf{elif}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq -7.747600213493845 \cdot 10^{-249}:\\ \;\;\;\;\left(\frac{y \cdot t}{a - z} + \left(x + \frac{x \cdot z}{a - z}\right)\right) - \left(\frac{x \cdot y}{a - z} + \frac{z \cdot t}{a - z}\right)\\ \mathbf{elif}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq 0:\\ \;\;\;\;\left(\frac{a \cdot \left(x \cdot y\right)}{{z}^{2}} + \left(\frac{t \cdot {a}^{2}}{{z}^{2}} + \left(t + \left(\frac{x \cdot y}{z} + \frac{t \cdot a}{z}\right)\right)\right)\right) - \left(\frac{x \cdot a}{z} + \left(\frac{t \cdot \left(y \cdot a\right)}{{z}^{2}} + \left(\frac{y \cdot t}{z} + \frac{x \cdot {a}^{2}}{{z}^{2}}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{t - x}{\frac{a - z}{y - z}}\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq -\infty:\\
\;\;\;\;\left(y - z\right) \cdot \frac{t}{a - z}\\

\mathbf{elif}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq -7.747600213493845 \cdot 10^{-249}:\\
\;\;\;\;\left(\frac{y \cdot t}{a - z} + \left(x + \frac{x \cdot z}{a - z}\right)\right) - \left(\frac{x \cdot y}{a - z} + \frac{z \cdot t}{a - z}\right)\\

\mathbf{elif}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq 0:\\
\;\;\;\;\left(\frac{a \cdot \left(x \cdot y\right)}{{z}^{2}} + \left(\frac{t \cdot {a}^{2}}{{z}^{2}} + \left(t + \left(\frac{x \cdot y}{z} + \frac{t \cdot a}{z}\right)\right)\right)\right) - \left(\frac{x \cdot a}{z} + \left(\frac{t \cdot \left(y \cdot a\right)}{{z}^{2}} + \left(\frac{y \cdot t}{z} + \frac{x \cdot {a}^{2}}{{z}^{2}}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x + \frac{t - x}{\frac{a - z}{y - z}}\\

\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) (- t x)) (- a z))))
(FPCore (x y z t a)
 :precision binary64
 (if (<= (+ x (/ (* (- y z) (- t x)) (- a z))) (- INFINITY))
   (* (- y z) (/ t (- a z)))
   (if (<= (+ x (/ (* (- y z) (- t x)) (- a z))) -7.747600213493845e-249)
     (-
      (+ (/ (* y t) (- a z)) (+ x (/ (* x z) (- a z))))
      (+ (/ (* x y) (- a z)) (/ (* z t) (- a z))))
     (if (<= (+ x (/ (* (- y z) (- t x)) (- a z))) 0.0)
       (-
        (+
         (/ (* a (* x y)) (pow z 2.0))
         (+
          (/ (* t (pow a 2.0)) (pow z 2.0))
          (+ t (+ (/ (* x y) z) (/ (* t a) z)))))
        (+
         (/ (* x a) z)
         (+
          (/ (* t (* y a)) (pow z 2.0))
          (+ (/ (* y t) z) (/ (* x (pow a 2.0)) (pow z 2.0))))))
       (+ x (/ (- t x) (/ (- a z) (- y z))))))))
double code(double x, double y, double z, double t, double a) {
	return x + (((y - z) * (t - x)) / (a - z));
}
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((x + (((y - z) * (t - x)) / (a - z))) <= -((double) INFINITY)) {
		tmp = (y - z) * (t / (a - z));
	} else if ((x + (((y - z) * (t - x)) / (a - z))) <= -7.747600213493845e-249) {
		tmp = (((y * t) / (a - z)) + (x + ((x * z) / (a - z)))) - (((x * y) / (a - z)) + ((z * t) / (a - z)));
	} else if ((x + (((y - z) * (t - x)) / (a - z))) <= 0.0) {
		tmp = (((a * (x * y)) / pow(z, 2.0)) + (((t * pow(a, 2.0)) / pow(z, 2.0)) + (t + (((x * y) / z) + ((t * a) / z))))) - (((x * a) / z) + (((t * (y * a)) / pow(z, 2.0)) + (((y * t) / z) + ((x * pow(a, 2.0)) / pow(z, 2.0)))));
	} else {
		tmp = x + ((t - x) / ((a - z) / (y - z)));
	}
	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

Original24.6
Target11.9
Herbie8.2
\[\begin{array}{l} \mathbf{if}\;z < -1.2536131056095036 \cdot 10^{+188}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \mathbf{elif}\;z < 4.446702369113811 \cdot 10^{+64}:\\ \;\;\;\;x + \frac{y - z}{\frac{a - z}{t - x}}\\ \mathbf{else}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \end{array}\]

Derivation

  1. Split input into 4 regimes
  2. if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -inf.0

    1. Initial program 64.0

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt_binary64_1648164.0

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

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

      \[\leadsto x + \left(\sqrt[3]{\frac{y - z}{a - z} \cdot \left(t - x\right)} \cdot \sqrt[3]{\frac{y - z}{a - z} \cdot \left(t - x\right)}\right) \cdot \color{blue}{\sqrt[3]{\frac{y - z}{a - z} \cdot \left(t - x\right)}}\]
    6. Taylor expanded around 0 60.0

      \[\leadsto \color{blue}{\frac{t \cdot y}{a - z} - \frac{t \cdot z}{a - z}}\]
    7. Simplified26.0

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

    if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -7.74760021349384453e-249

    1. Initial program 2.1

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

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

    if -7.74760021349384453e-249 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < 0.0

    1. Initial program 56.8

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
    2. Taylor expanded around inf 8.2

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

    if 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z)))

    1. Initial program 21.3

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
    2. Using strategy rm
    3. Applied clear-num_binary64_1644521.3

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

      \[\leadsto x + \frac{1}{\color{blue}{\frac{a - z}{\left(t - x\right) \cdot \left(y - z\right)}}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity_binary64_1644621.3

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq -\infty:\\ \;\;\;\;\left(y - z\right) \cdot \frac{t}{a - z}\\ \mathbf{elif}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq -7.747600213493845 \cdot 10^{-249}:\\ \;\;\;\;\left(\frac{y \cdot t}{a - z} + \left(x + \frac{x \cdot z}{a - z}\right)\right) - \left(\frac{x \cdot y}{a - z} + \frac{z \cdot t}{a - z}\right)\\ \mathbf{elif}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq 0:\\ \;\;\;\;\left(\frac{a \cdot \left(x \cdot y\right)}{{z}^{2}} + \left(\frac{t \cdot {a}^{2}}{{z}^{2}} + \left(t + \left(\frac{x \cdot y}{z} + \frac{t \cdot a}{z}\right)\right)\right)\right) - \left(\frac{x \cdot a}{z} + \left(\frac{t \cdot \left(y \cdot a\right)}{{z}^{2}} + \left(\frac{y \cdot t}{z} + \frac{x \cdot {a}^{2}}{{z}^{2}}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{t - x}{\frac{a - z}{y - z}}\\ \end{array}\]

Reproduce

herbie shell --seed 2021098 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Chart.Axis.Types:invLinMap from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (if (< z -1.2536131056095036e+188) (- t (* (/ y z) (- t x))) (if (< z 4.446702369113811e+64) (+ x (/ (- y z) (/ (- a z) (- t x)))) (- t (* (/ y z) (- t x)))))

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