Average Error: 25.1 → 11.6
Time: 5.5s
Precision: binary64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -4.4256913699412465 \cdot 10^{-114} \lor \neg \left(a \le 9.14085606067376745 \cdot 10^{-157}\right):\\ \;\;\;\;x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \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}\;a \le -4.4256913699412465 \cdot 10^{-114} \lor \neg \left(a \le 9.14085606067376745 \cdot 10^{-157}\right):\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\

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

\end{array}
double code(double x, double y, double z, double t, double a) {
	return ((double) (x + (((double) (((double) (y - z)) * ((double) (t - x)))) / ((double) (a - z)))));
}
double code(double x, double y, double z, double t, double a) {
	double VAR;
	if (((a <= -4.4256913699412465e-114) || !(a <= 9.140856060673767e-157))) {
		VAR = ((double) (x + ((double) (((double) (y - z)) * (((double) (t - x)) / ((double) (a - z)))))));
	} else {
		VAR = ((double) (t + ((double) ((y / z) * ((double) (x - 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

Original25.1
Target12.7
Herbie11.6
\[\begin{array}{l} \mathbf{if}\;z \lt -1.25361310560950359 \cdot 10^{188}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \mathbf{elif}\;z \lt 4.44670236911381103 \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 a < -4.4256913699412465e-114 or 9.14085606067376745e-157 < a

    1. Initial program 23.6

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

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

    if -4.4256913699412465e-114 < a < 9.14085606067376745e-157

    1. Initial program 29.8

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

      \[\leadsto \color{blue}{x + \left(y - z\right) \cdot \frac{t - x}{a - z}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt25.5

      \[\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}}}\]
    5. Applied add-cube-cbrt25.6

      \[\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}}\]
    6. Applied times-frac25.7

      \[\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)}\]
    7. Applied associate-*r*20.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}}}\]
    8. Simplified20.1

      \[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot \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}}\]
    9. Using strategy rm
    10. Applied associate-*r*19.2

      \[\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}}\]
    11. Taylor expanded around inf 15.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -4.4256913699412465 \cdot 10^{-114} \lor \neg \left(a \le 9.14085606067376745 \cdot 10^{-157}\right):\\ \;\;\;\;x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \mathbf{else}:\\ \;\;\;\;t + \frac{y}{z} \cdot \left(x - t\right)\\ \end{array}\]

Reproduce

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