Average Error: 10.8 → 0.5
Time: 17.1s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;y \le -6.052162249708099241513091933774390871208 \cdot 10^{-108} \lor \neg \left(y \le 1.426243921064187849725682052555273082691 \cdot 10^{-32}\right):\\ \;\;\;\;\frac{\frac{z - t}{a - t}}{\frac{1}{y}} + x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\left(z - t\right) \cdot y}{a - t}\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;y \le -6.052162249708099241513091933774390871208 \cdot 10^{-108} \lor \neg \left(y \le 1.426243921064187849725682052555273082691 \cdot 10^{-32}\right):\\
\;\;\;\;\frac{\frac{z - t}{a - t}}{\frac{1}{y}} + x\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r355625 = x;
        double r355626 = y;
        double r355627 = z;
        double r355628 = t;
        double r355629 = r355627 - r355628;
        double r355630 = r355626 * r355629;
        double r355631 = a;
        double r355632 = r355631 - r355628;
        double r355633 = r355630 / r355632;
        double r355634 = r355625 + r355633;
        return r355634;
}

double f(double x, double y, double z, double t, double a) {
        double r355635 = y;
        double r355636 = -6.052162249708099e-108;
        bool r355637 = r355635 <= r355636;
        double r355638 = 1.4262439210641878e-32;
        bool r355639 = r355635 <= r355638;
        double r355640 = !r355639;
        bool r355641 = r355637 || r355640;
        double r355642 = z;
        double r355643 = t;
        double r355644 = r355642 - r355643;
        double r355645 = a;
        double r355646 = r355645 - r355643;
        double r355647 = r355644 / r355646;
        double r355648 = 1.0;
        double r355649 = r355648 / r355635;
        double r355650 = r355647 / r355649;
        double r355651 = x;
        double r355652 = r355650 + r355651;
        double r355653 = r355644 * r355635;
        double r355654 = r355653 / r355646;
        double r355655 = r355651 + r355654;
        double r355656 = r355641 ? r355652 : r355655;
        return r355656;
}

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.8
Target1.2
Herbie0.5
\[x + \frac{y}{\frac{a - t}{z - t}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -6.052162249708099e-108 or 1.4262439210641878e-32 < y

    1. Initial program 18.4

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

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

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

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

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

      \[\leadsto \frac{z - t}{\color{blue}{\left(a - t\right) \cdot \frac{1}{y}}} + x\]
    10. Applied associate-/r*0.6

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

    if -6.052162249708099e-108 < y < 1.4262439210641878e-32

    1. Initial program 0.4

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

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

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

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

      \[\leadsto \color{blue}{\frac{z - t}{\frac{a - t}{y}}} + x\]
    8. Using strategy rm
    9. Applied *-un-lft-identity4.1

      \[\leadsto \frac{z - t}{\frac{a - t}{\color{blue}{1 \cdot y}}} + x\]
    10. Applied *-un-lft-identity4.1

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

      \[\leadsto \frac{z - t}{\color{blue}{\frac{1}{1} \cdot \frac{a - t}{y}}} + x\]
    12. Applied *-un-lft-identity4.1

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

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

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

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

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

Reproduce

herbie shell --seed 2019347 +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))))