Average Error: 24.6 → 11.6
Time: 11.0s
Precision: 64
\[x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;a \le -4.0098790375020589 \cdot 10^{-70}:\\ \;\;\;\;x + \frac{y - x}{a - t} \cdot \left(z - t\right)\\ \mathbf{elif}\;a \le 3.8034022935305039 \cdot 10^{-125}:\\ \;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \end{array}\]
x + \frac{\left(y - x\right) \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;a \le -4.0098790375020589 \cdot 10^{-70}:\\
\;\;\;\;x + \frac{y - x}{a - t} \cdot \left(z - t\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r690791 = x;
        double r690792 = y;
        double r690793 = r690792 - r690791;
        double r690794 = z;
        double r690795 = t;
        double r690796 = r690794 - r690795;
        double r690797 = r690793 * r690796;
        double r690798 = a;
        double r690799 = r690798 - r690795;
        double r690800 = r690797 / r690799;
        double r690801 = r690791 + r690800;
        return r690801;
}

double f(double x, double y, double z, double t, double a) {
        double r690802 = a;
        double r690803 = -4.009879037502059e-70;
        bool r690804 = r690802 <= r690803;
        double r690805 = x;
        double r690806 = y;
        double r690807 = r690806 - r690805;
        double r690808 = t;
        double r690809 = r690802 - r690808;
        double r690810 = r690807 / r690809;
        double r690811 = z;
        double r690812 = r690811 - r690808;
        double r690813 = r690810 * r690812;
        double r690814 = r690805 + r690813;
        double r690815 = 3.803402293530504e-125;
        bool r690816 = r690802 <= r690815;
        double r690817 = r690805 * r690811;
        double r690818 = r690817 / r690808;
        double r690819 = r690806 + r690818;
        double r690820 = r690811 * r690806;
        double r690821 = r690820 / r690808;
        double r690822 = r690819 - r690821;
        double r690823 = r690809 / r690812;
        double r690824 = r690807 / r690823;
        double r690825 = r690805 + r690824;
        double r690826 = r690816 ? r690822 : r690825;
        double r690827 = r690804 ? r690814 : r690826;
        return r690827;
}

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.6
Target9.1
Herbie11.6
\[\begin{array}{l} \mathbf{if}\;a \lt -1.6153062845442575 \cdot 10^{-142}:\\ \;\;\;\;x + \frac{y - x}{1} \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;a \lt 3.7744031700831742 \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 < -4.009879037502059e-70

    1. Initial program 23.0

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

      \[\leadsto x + \color{blue}{\frac{y - x}{\frac{a - t}{z - t}}}\]
    4. Using strategy rm
    5. Applied associate-/r/10.2

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

    if -4.009879037502059e-70 < a < 3.803402293530504e-125

    1. Initial program 29.2

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

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

    if 3.803402293530504e-125 < a

    1. Initial program 22.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -4.0098790375020589 \cdot 10^{-70}:\\ \;\;\;\;x + \frac{y - x}{a - t} \cdot \left(z - t\right)\\ \mathbf{elif}\;a \le 3.8034022935305039 \cdot 10^{-125}:\\ \;\;\;\;\left(y + \frac{x \cdot z}{t}\right) - \frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{a - t}{z - t}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020047 
(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.774403170083174e-182) (- y (* (/ z t) (- y x))) (+ x (* (/ (- y x) 1) (/ (- z t) (- a t))))))

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