Average Error: 24.4 → 12.3
Time: 17.7s
Precision: binary64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \leq -1.8535004913060756 \cdot 10^{+161}:\\ \;\;\;\;\left(t + \frac{x \cdot y}{z}\right) - \frac{t \cdot y}{z}\\ \mathbf{elif}\;z \leq -7.081586002361856 \cdot 10^{-216}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{a - z}{t - x}}{y - z}}\\ \mathbf{elif}\;z \leq 1.9038582755546934 \cdot 10^{+95}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{a - z}{y - z}}{t - x}}\\ \mathbf{elif}\;z \leq 5.2911909187746226 \cdot 10^{+197}:\\ \;\;\;\;\left(t + \left(\frac{x \cdot y}{z} + \frac{t \cdot a}{z}\right)\right) - \left(\frac{t \cdot y}{z} + \frac{x \cdot a}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{y - z}{a - z}\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;z \leq -1.8535004913060756 \cdot 10^{+161}:\\
\;\;\;\;\left(t + \frac{x \cdot y}{z}\right) - \frac{t \cdot y}{z}\\

\mathbf{elif}\;z \leq -7.081586002361856 \cdot 10^{-216}:\\
\;\;\;\;x + \frac{1}{\frac{\frac{a - z}{t - x}}{y - z}}\\

\mathbf{elif}\;z \leq 1.9038582755546934 \cdot 10^{+95}:\\
\;\;\;\;x + \frac{1}{\frac{\frac{a - z}{y - z}}{t - x}}\\

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

\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - z}{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 (<= z -1.8535004913060756e+161)
   (- (+ t (/ (* x y) z)) (/ (* t y) z))
   (if (<= z -7.081586002361856e-216)
     (+ x (/ 1.0 (/ (/ (- a z) (- t x)) (- y z))))
     (if (<= z 1.9038582755546934e+95)
       (+ x (/ 1.0 (/ (/ (- a z) (- y z)) (- t x))))
       (if (<= z 5.2911909187746226e+197)
         (-
          (+ t (+ (/ (* x y) z) (/ (* t a) z)))
          (+ (/ (* t y) z) (/ (* x a) z)))
         (* t (/ (- y z) (- a 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 (z <= -1.8535004913060756e+161) {
		tmp = (t + ((x * y) / z)) - ((t * y) / z);
	} else if (z <= -7.081586002361856e-216) {
		tmp = x + (1.0 / (((a - z) / (t - x)) / (y - z)));
	} else if (z <= 1.9038582755546934e+95) {
		tmp = x + (1.0 / (((a - z) / (y - z)) / (t - x)));
	} else if (z <= 5.2911909187746226e+197) {
		tmp = (t + (((x * y) / z) + ((t * a) / z))) - (((t * y) / z) + ((x * a) / z));
	} else {
		tmp = t * ((y - z) / (a - 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.4
Target11.2
Herbie12.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 5 regimes
  2. if z < -1.8535004913060756e161

    1. Initial program 47.8

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

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

    if -1.8535004913060756e161 < z < -7.0815860023618558e-216

    1. Initial program 17.3

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

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

      \[\leadsto x + \color{blue}{\frac{1}{\frac{\frac{a - z}{t - x}}{y - z}}}\]

    if -7.0815860023618558e-216 < z < 1.903858275554693e95

    1. Initial program 11.4

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

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

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

      \[\leadsto x + \frac{\color{blue}{\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \left(t - x\right)}}{\sqrt[3]{a - z}}\]
    6. Using strategy rm
    7. Applied clear-num_binary64_164457.0

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

      \[\leadsto x + \frac{1}{\color{blue}{\frac{\frac{a - z}{y - z}}{t - x}}}\]

    if 1.903858275554693e95 < z < 5.2911909187746226e197

    1. Initial program 37.5

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

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

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

    if 5.2911909187746226e197 < z

    1. Initial program 50.9

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

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

      \[\leadsto \color{blue}{t \cdot \frac{y - z}{a - z}}\]
  3. Recombined 5 regimes into one program.
  4. Final simplification12.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.8535004913060756 \cdot 10^{+161}:\\ \;\;\;\;\left(t + \frac{x \cdot y}{z}\right) - \frac{t \cdot y}{z}\\ \mathbf{elif}\;z \leq -7.081586002361856 \cdot 10^{-216}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{a - z}{t - x}}{y - z}}\\ \mathbf{elif}\;z \leq 1.9038582755546934 \cdot 10^{+95}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{a - z}{y - z}}{t - x}}\\ \mathbf{elif}\;z \leq 5.2911909187746226 \cdot 10^{+197}:\\ \;\;\;\;\left(t + \left(\frac{x \cdot y}{z} + \frac{t \cdot a}{z}\right)\right) - \left(\frac{t \cdot y}{z} + \frac{x \cdot a}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{y - z}{a - z}\\ \end{array}\]

Reproduce

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