Average Error: 24.3 → 10.2
Time: 32.3s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.903940587482351271448540463407352524949 \cdot 10^{-94}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{a - t}{z - t}}{y - x}}\\ \mathbf{elif}\;a \le 2.486579097351087244398754404400467109927 \cdot 10^{-154}:\\ \;\;\;\;\left(\frac{x \cdot z}{t} + y\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 -1.903940587482351271448540463407352524949 \cdot 10^{-94}:\\
\;\;\;\;x + \frac{1}{\frac{\frac{a - t}{z - t}}{y - x}}\\

\mathbf{elif}\;a \le 2.486579097351087244398754404400467109927 \cdot 10^{-154}:\\
\;\;\;\;\left(\frac{x \cdot z}{t} + y\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 r41409806 = x;
        double r41409807 = y;
        double r41409808 = r41409807 - r41409806;
        double r41409809 = z;
        double r41409810 = t;
        double r41409811 = r41409809 - r41409810;
        double r41409812 = r41409808 * r41409811;
        double r41409813 = a;
        double r41409814 = r41409813 - r41409810;
        double r41409815 = r41409812 / r41409814;
        double r41409816 = r41409806 + r41409815;
        return r41409816;
}

double f(double x, double y, double z, double t, double a) {
        double r41409817 = a;
        double r41409818 = -1.9039405874823513e-94;
        bool r41409819 = r41409817 <= r41409818;
        double r41409820 = x;
        double r41409821 = 1.0;
        double r41409822 = t;
        double r41409823 = r41409817 - r41409822;
        double r41409824 = z;
        double r41409825 = r41409824 - r41409822;
        double r41409826 = r41409823 / r41409825;
        double r41409827 = y;
        double r41409828 = r41409827 - r41409820;
        double r41409829 = r41409826 / r41409828;
        double r41409830 = r41409821 / r41409829;
        double r41409831 = r41409820 + r41409830;
        double r41409832 = 2.4865790973510872e-154;
        bool r41409833 = r41409817 <= r41409832;
        double r41409834 = r41409820 * r41409824;
        double r41409835 = r41409834 / r41409822;
        double r41409836 = r41409835 + r41409827;
        double r41409837 = r41409824 * r41409827;
        double r41409838 = r41409837 / r41409822;
        double r41409839 = r41409836 - r41409838;
        double r41409840 = r41409833 ? r41409839 : r41409831;
        double r41409841 = r41409819 ? r41409831 : r41409840;
        return r41409841;
}

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.3
Target9.0
Herbie10.2
\[\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 2 regimes
  2. if a < -1.9039405874823513e-94 or 2.4865790973510872e-154 < 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.6

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

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

    if -1.9039405874823513e-94 < a < 2.4865790973510872e-154

    1. Initial program 29.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.903940587482351271448540463407352524949 \cdot 10^{-94}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{a - t}{z - t}}{y - x}}\\ \mathbf{elif}\;a \le 2.486579097351087244398754404400467109927 \cdot 10^{-154}:\\ \;\;\;\;\left(\frac{x \cdot z}{t} + y\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 2019171 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Chart.Axis.Types:linMap from Chart-1.5.3"

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

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