Average Error: 10.6 → 0.6
Time: 19.0s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot t}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;t \le -3.621409335508072898622395529775828545171 \cdot 10^{-15} \lor \neg \left(t \le 6.874929093463645168164571333770296454924 \cdot 10^{-172}\right):\\ \;\;\;\;\frac{t}{\frac{a - z}{y - z}} + x\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{a - z} \cdot \left(\left(y - z\right) \cdot t\right) + x\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot t}{a - z}
\begin{array}{l}
\mathbf{if}\;t \le -3.621409335508072898622395529775828545171 \cdot 10^{-15} \lor \neg \left(t \le 6.874929093463645168164571333770296454924 \cdot 10^{-172}\right):\\
\;\;\;\;\frac{t}{\frac{a - z}{y - z}} + x\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r333823 = x;
        double r333824 = y;
        double r333825 = z;
        double r333826 = r333824 - r333825;
        double r333827 = t;
        double r333828 = r333826 * r333827;
        double r333829 = a;
        double r333830 = r333829 - r333825;
        double r333831 = r333828 / r333830;
        double r333832 = r333823 + r333831;
        return r333832;
}

double f(double x, double y, double z, double t, double a) {
        double r333833 = t;
        double r333834 = -3.621409335508073e-15;
        bool r333835 = r333833 <= r333834;
        double r333836 = 6.874929093463645e-172;
        bool r333837 = r333833 <= r333836;
        double r333838 = !r333837;
        bool r333839 = r333835 || r333838;
        double r333840 = a;
        double r333841 = z;
        double r333842 = r333840 - r333841;
        double r333843 = y;
        double r333844 = r333843 - r333841;
        double r333845 = r333842 / r333844;
        double r333846 = r333833 / r333845;
        double r333847 = x;
        double r333848 = r333846 + r333847;
        double r333849 = 1.0;
        double r333850 = r333849 / r333842;
        double r333851 = r333844 * r333833;
        double r333852 = r333850 * r333851;
        double r333853 = r333852 + r333847;
        double r333854 = r333839 ? r333848 : r333853;
        return r333854;
}

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.6
Target0.5
Herbie0.6
\[\begin{array}{l} \mathbf{if}\;t \lt -1.068297449017406694366747246993994850729 \cdot 10^{-39}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \mathbf{elif}\;t \lt 3.911094988758637497591020599238553861375 \cdot 10^{-141}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if t < -3.621409335508073e-15 or 6.874929093463645e-172 < t

    1. Initial program 16.9

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

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

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

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

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

    if -3.621409335508073e-15 < t < 6.874929093463645e-172

    1. Initial program 0.3

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

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

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

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

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

      \[\leadsto \frac{t}{\color{blue}{\left(a - z\right) \cdot \frac{1}{y - z}}} + x\]
    10. Applied *-un-lft-identity2.0

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

      \[\leadsto \color{blue}{\frac{1}{a - z} \cdot \frac{t}{\frac{1}{y - z}}} + x\]
    12. Simplified0.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -3.621409335508072898622395529775828545171 \cdot 10^{-15} \lor \neg \left(t \le 6.874929093463645168164571333770296454924 \cdot 10^{-172}\right):\\ \;\;\;\;\frac{t}{\frac{a - z}{y - z}} + x\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{a - z} \cdot \left(\left(y - z\right) \cdot t\right) + x\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< t -1.0682974490174067e-39) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t))))

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