Average Error: 24.4 → 11.5
Time: 28.3s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -2.368254136616310484006967857427528249355 \cdot 10^{-48}:\\ \;\;\;\;x + \left(y - x\right) \cdot \left(\left(z - t\right) \cdot \frac{1}{a - t}\right)\\ \mathbf{elif}\;a \le 2.728706087853961537976531768816465205049 \cdot 10^{-108}:\\ \;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{a - t}{z - t}}{y - x}}\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;a \le -2.368254136616310484006967857427528249355 \cdot 10^{-48}:\\
\;\;\;\;x + \left(y - x\right) \cdot \left(\left(z - t\right) \cdot \frac{1}{a - t}\right)\\

\mathbf{elif}\;a \le 2.728706087853961537976531768816465205049 \cdot 10^{-108}:\\
\;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{1}{\frac{\frac{a - t}{z - t}}{y - x}}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r432801 = x;
        double r432802 = y;
        double r432803 = r432802 - r432801;
        double r432804 = z;
        double r432805 = t;
        double r432806 = r432804 - r432805;
        double r432807 = r432803 * r432806;
        double r432808 = a;
        double r432809 = r432808 - r432805;
        double r432810 = r432807 / r432809;
        double r432811 = r432801 + r432810;
        return r432811;
}

double f(double x, double y, double z, double t, double a) {
        double r432812 = a;
        double r432813 = -2.3682541366163105e-48;
        bool r432814 = r432812 <= r432813;
        double r432815 = x;
        double r432816 = y;
        double r432817 = r432816 - r432815;
        double r432818 = z;
        double r432819 = t;
        double r432820 = r432818 - r432819;
        double r432821 = 1.0;
        double r432822 = r432812 - r432819;
        double r432823 = r432821 / r432822;
        double r432824 = r432820 * r432823;
        double r432825 = r432817 * r432824;
        double r432826 = r432815 + r432825;
        double r432827 = 2.7287060878539615e-108;
        bool r432828 = r432812 <= r432827;
        double r432829 = r432815 * r432818;
        double r432830 = r432829 / r432819;
        double r432831 = r432816 + r432830;
        double r432832 = r432818 * r432816;
        double r432833 = r432832 / r432819;
        double r432834 = r432831 - r432833;
        double r432835 = r432822 / r432820;
        double r432836 = r432835 / r432817;
        double r432837 = r432821 / r432836;
        double r432838 = r432815 + r432837;
        double r432839 = r432828 ? r432834 : r432838;
        double r432840 = r432814 ? r432826 : r432839;
        return r432840;
}

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
Target9.3
Herbie11.5
\[\begin{array}{l} \mathbf{if}\;a \lt -1.615306284544257464183904494091872805513 \cdot 10^{-142}:\\ \;\;\;\;x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;a \lt 3.774403170083174201868024161554637965035 \cdot 10^{-182}:\\ \;\;\;\;y - \frac{z}{t} \cdot \left(y - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if a < -2.3682541366163105e-48

    1. Initial program 22.4

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

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

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

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

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

    if -2.3682541366163105e-48 < a < 2.7287060878539615e-108

    1. Initial program 28.4

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

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

    if 2.7287060878539615e-108 < a

    1. Initial program 22.5

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -2.368254136616310484006967857427528249355 \cdot 10^{-48}:\\ \;\;\;\;x + \left(y - x\right) \cdot \left(\left(z - t\right) \cdot \frac{1}{a - t}\right)\\ \mathbf{elif}\;a \le 2.728706087853961537976531768816465205049 \cdot 10^{-108}:\\ \;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{a - t}{z - t}}{y - x}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019304 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (if (< a -1.6153062845442575e-142) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t)))) (if (< a 3.7744031700831742e-182) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t))))))

  (+ x (/ (* (- y x) (- z t)) (- a t))))