Average Error: 24.6 → 9.3
Time: 10.2s
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 -4.10442963889481 \cdot 10^{-200} \lor \neg \left(x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq 0\right):\\ \;\;\;\;x + \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}} \cdot \left(\frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}} \cdot \left(\left(y - z\right) \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t + \frac{y}{z} \cdot \left(x - t\right)\\ \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 -4.10442963889481 \cdot 10^{-200} \lor \neg \left(x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq 0\right):\\
\;\;\;\;x + \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}} \cdot \left(\frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}} \cdot \left(\left(y - z\right) \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\right)\right)\\

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

\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 (or (<= (+ x (/ (* (- y z) (- t x)) (- a z))) -4.10442963889481e-200)
         (not (<= (+ x (/ (* (- y z) (- t x)) (- a z))) 0.0)))
   (+
    x
    (*
     (/ (cbrt (- t x)) (cbrt (- a z)))
     (*
      (/ (cbrt (- t x)) (cbrt (- a z)))
      (* (- y z) (/ (cbrt (- t x)) (cbrt (- a z)))))))
   (+ t (* (/ y z) (- x t)))))
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))) <= -4.10442963889481e-200) || !((x + (((y - z) * (t - x)) / (a - z))) <= 0.0)) {
		tmp = x + ((cbrt(t - x) / cbrt(a - z)) * ((cbrt(t - x) / cbrt(a - z)) * ((y - z) * (cbrt(t - x) / cbrt(a - z)))));
	} else {
		tmp = t + ((y / z) * (x - t));
	}
	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.8
Herbie9.3
\[\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 2 regimes
  2. if (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z))) < -4.1044296388948098e-200 or 0.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y z) (-.f64 t x)) (-.f64 a z)))

    1. Initial program 21.7

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

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

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

      \[\leadsto x + \color{blue}{\left(y - z\right)} \cdot \frac{t - x}{a - z}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt_binary64_1325211.2

      \[\leadsto x + \left(y - z\right) \cdot \frac{t - x}{\color{blue}{\left(\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}\right) \cdot \sqrt[3]{a - z}}}\]
    8. Applied add-cube-cbrt_binary64_1325211.4

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

      \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\left(\frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\right)}\]
    10. Applied associate-*r*_binary64_131628.0

      \[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot \frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}\right) \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}}\]
    11. Using strategy rm
    12. Applied times-frac_binary64_132268.0

      \[\leadsto x + \left(\left(y - z\right) \cdot \color{blue}{\left(\frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}} \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\right)}\right) \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\]
    13. Applied associate-*r*_binary64_131627.7

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

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

    1. Initial program 50.2

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

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

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

      \[\leadsto x + \color{blue}{\left(y - z\right)} \cdot \frac{t - x}{a - z}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt_binary64_1325252.2

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

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

      \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\left(\frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\right)}\]
    10. Applied associate-*r*_binary64_1316250.4

      \[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot \frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}\right) \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}}\]
    11. Using strategy rm
    12. Applied times-frac_binary64_1322650.4

      \[\leadsto x + \left(\left(y - z\right) \cdot \color{blue}{\left(\frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}} \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\right)}\right) \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\]
    13. Applied associate-*r*_binary64_1316249.5

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq -4.10442963889481 \cdot 10^{-200} \lor \neg \left(x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq 0\right):\\ \;\;\;\;x + \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}} \cdot \left(\frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}} \cdot \left(\left(y - z\right) \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t + \frac{y}{z} \cdot \left(x - t\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020292 
(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))))