Average Error: 25.3 → 9.7
Time: 6.9s
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 -5.734382662412291 \cdot 10^{-301}:\\ \;\;\;\;x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \mathbf{elif}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq 0:\\ \;\;\;\;t + y \cdot \left(\frac{x}{z} - \frac{t}{z}\right)\\ \mathbf{elif}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \leq 6.627278791044968 \cdot 10^{+290}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - z\right) \cdot \frac{t - x}{a - 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 -5.734382662412291 \cdot 10^{-301}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\

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

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

\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t - x}{a - 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))) -5.734382662412291e-301)
   (+ x (* (- y z) (/ (- t x) (- a z))))
   (if (<= (+ x (/ (* (- y z) (- t x)) (- a z))) 0.0)
     (+ t (* y (- (/ x z) (/ t z))))
     (if (<= (+ x (/ (* (- y z) (- t x)) (- a z))) 6.627278791044968e+290)
       (+ x (/ (* (- y z) (- t x)) (- a z)))
       (+ x (* (- y z) (/ (- t x) (- a z))))))))
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 ((((double) (x + (((double) (((double) (y - z)) * ((double) (t - x)))) / ((double) (a - z))))) <= -5.734382662412291e-301)) {
		VAR = ((double) (x + ((double) (((double) (y - z)) * (((double) (t - x)) / ((double) (a - z)))))));
	} else {
		double VAR_1;
		if ((((double) (x + (((double) (((double) (y - z)) * ((double) (t - x)))) / ((double) (a - z))))) <= 0.0)) {
			VAR_1 = ((double) (t + ((double) (y * ((double) ((x / z) - (t / z)))))));
		} else {
			double VAR_2;
			if ((((double) (x + (((double) (((double) (y - z)) * ((double) (t - x)))) / ((double) (a - z))))) <= 6.627278791044968e+290)) {
				VAR_2 = ((double) (x + (((double) (((double) (y - z)) * ((double) (t - x)))) / ((double) (a - z)))));
			} else {
				VAR_2 = ((double) (x + ((double) (((double) (y - z)) * (((double) (t - x)) / ((double) (a - z)))))));
			}
			VAR_1 = VAR_2;
		}
		VAR = VAR_1;
	}
	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.3
Target11.8
Herbie9.7
\[\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 3 regimes
  2. if (+ x (/ (* (- y z) (- t x)) (- a z))) < -5.73438266241229124e-301 or 6.62727879104496755e290 < (+ x (/ (* (- y z) (- t x)) (- a z)))

    1. Initial program 32.0

      \[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 -5.73438266241229124e-301 < (+ x (/ (* (- y z) (- t x)) (- a z))) < 0.0

    1. Initial program 61.0

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

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

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

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

    if 0.0 < (+ x (/ (* (- y z) (- t x)) (- a z))) < 6.62727879104496755e290

    1. Initial program 2.2

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

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

Reproduce

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