Average Error: 24.8 → 9.9
Time: 3.9s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -3.4874247514004929 \cdot 10^{-149} \lor \neg \left(a \le 2.66694816957246522 \cdot 10^{-200}\right):\\ \;\;\;\;x + \frac{t - x}{\frac{a}{y - z} - \frac{-z}{-\left(y - z\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{x \cdot y}{z} + t\right) - \frac{t \cdot y}{z}\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -3.4874247514004929 \cdot 10^{-149} \lor \neg \left(a \le 2.66694816957246522 \cdot 10^{-200}\right):\\
\;\;\;\;x + \frac{t - x}{\frac{a}{y - z} - \frac{-z}{-\left(y - z\right)}}\\

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

\end{array}
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 VAR;
	if (((a <= -3.487424751400493e-149) || !(a <= 2.666948169572465e-200))) {
		VAR = (x + ((t - x) / ((a / (y - z)) - (-z / -(y - z)))));
	} else {
		VAR = ((((x * y) / z) + t) - ((t * y) / z));
	}
	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

Original24.8
Target11.8
Herbie9.9
\[\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 < -3.487424751400493e-149 or 2.666948169572465e-200 < a

    1. Initial program 23.6

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

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

      \[\leadsto x + \color{blue}{\frac{t - x}{\frac{a - z}{y - z}}}\]
    5. Using strategy rm
    6. Applied div-sub9.6

      \[\leadsto x + \frac{t - x}{\color{blue}{\frac{a}{y - z} - \frac{z}{y - z}}}\]
    7. Using strategy rm
    8. Applied frac-2neg9.6

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

    if -3.487424751400493e-149 < a < 2.666948169572465e-200

    1. Initial program 29.7

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

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

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

Reproduce

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