Average Error: 10.9 → 1.5
Time: 6.7s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.0071455594193599 \cdot 10^{-271} \lor \neg \left(t \le 8.49657610056407139 \cdot 10^{-71}\right):\\ \;\;\;\;y \cdot \left(\frac{z}{a - t} - \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{t}{a - t}\right)\right)\right) + x\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \left(z - t\right)}{a - t} + x\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;t \le -1.0071455594193599 \cdot 10^{-271} \lor \neg \left(t \le 8.49657610056407139 \cdot 10^{-71}\right):\\
\;\;\;\;y \cdot \left(\frac{z}{a - t} - \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{t}{a - t}\right)\right)\right) + x\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r541858 = x;
        double r541859 = y;
        double r541860 = z;
        double r541861 = t;
        double r541862 = r541860 - r541861;
        double r541863 = r541859 * r541862;
        double r541864 = a;
        double r541865 = r541864 - r541861;
        double r541866 = r541863 / r541865;
        double r541867 = r541858 + r541866;
        return r541867;
}

double f(double x, double y, double z, double t, double a) {
        double r541868 = t;
        double r541869 = -1.0071455594193599e-271;
        bool r541870 = r541868 <= r541869;
        double r541871 = 8.496576100564071e-71;
        bool r541872 = r541868 <= r541871;
        double r541873 = !r541872;
        bool r541874 = r541870 || r541873;
        double r541875 = y;
        double r541876 = z;
        double r541877 = a;
        double r541878 = r541877 - r541868;
        double r541879 = r541876 / r541878;
        double r541880 = r541868 / r541878;
        double r541881 = expm1(r541880);
        double r541882 = log1p(r541881);
        double r541883 = r541879 - r541882;
        double r541884 = r541875 * r541883;
        double r541885 = x;
        double r541886 = r541884 + r541885;
        double r541887 = r541876 - r541868;
        double r541888 = r541875 * r541887;
        double r541889 = r541888 / r541878;
        double r541890 = r541889 + r541885;
        double r541891 = r541874 ? r541886 : r541890;
        return r541891;
}

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

Original10.9
Target1.3
Herbie1.5
\[x + \frac{y}{\frac{a - t}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if t < -1.0071455594193599e-271 or 8.496576100564071e-71 < t

    1. Initial program 12.7

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{a - t}, z - t, x\right)}\]
    3. Using strategy rm
    4. Applied fma-udef2.9

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

      \[\leadsto \color{blue}{\left(y \cdot \frac{1}{a - t}\right)} \cdot \left(z - t\right) + x\]
    7. Applied associate-*l*0.9

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

      \[\leadsto y \cdot \color{blue}{\frac{z - t}{a - t}} + x\]
    9. Using strategy rm
    10. Applied div-sub0.8

      \[\leadsto y \cdot \color{blue}{\left(\frac{z}{a - t} - \frac{t}{a - t}\right)} + x\]
    11. Using strategy rm
    12. Applied log1p-expm1-u0.9

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

    if -1.0071455594193599e-271 < t < 8.496576100564071e-71

    1. Initial program 3.8

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{a - t}, z - t, x\right)}\]
    3. Using strategy rm
    4. Applied fma-udef3.5

      \[\leadsto \color{blue}{\frac{y}{a - t} \cdot \left(z - t\right) + x}\]
    5. Using strategy rm
    6. Applied associate-*l/3.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.0071455594193599 \cdot 10^{-271} \lor \neg \left(t \le 8.49657610056407139 \cdot 10^{-71}\right):\\ \;\;\;\;y \cdot \left(\frac{z}{a - t} - \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{t}{a - t}\right)\right)\right) + x\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \left(z - t\right)}{a - t} + x\\ \end{array}\]

Reproduce

herbie shell --seed 2020056 +o rules:numerics
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
  :precision binary64

  :herbie-target
  (+ x (/ y (/ (- a t) (- z t))))

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