Average Error: 10.2 → 1.4
Time: 18.3s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -4.347512852047913:\\ \;\;\;\;x + \frac{y}{\frac{a}{z - t} - \frac{t}{z - t}}\\ \mathbf{elif}\;t \le 2.7589848075703794 \cdot 10^{-216}:\\ \;\;\;\;x + \frac{\left(z - t\right) \cdot y}{a - t}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z - t}{a - t} + x\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a - t}
\begin{array}{l}
\mathbf{if}\;t \le -4.347512852047913:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t} - \frac{t}{z - t}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r23887650 = x;
        double r23887651 = y;
        double r23887652 = z;
        double r23887653 = t;
        double r23887654 = r23887652 - r23887653;
        double r23887655 = r23887651 * r23887654;
        double r23887656 = a;
        double r23887657 = r23887656 - r23887653;
        double r23887658 = r23887655 / r23887657;
        double r23887659 = r23887650 + r23887658;
        return r23887659;
}

double f(double x, double y, double z, double t, double a) {
        double r23887660 = t;
        double r23887661 = -4.347512852047913;
        bool r23887662 = r23887660 <= r23887661;
        double r23887663 = x;
        double r23887664 = y;
        double r23887665 = a;
        double r23887666 = z;
        double r23887667 = r23887666 - r23887660;
        double r23887668 = r23887665 / r23887667;
        double r23887669 = r23887660 / r23887667;
        double r23887670 = r23887668 - r23887669;
        double r23887671 = r23887664 / r23887670;
        double r23887672 = r23887663 + r23887671;
        double r23887673 = 2.7589848075703794e-216;
        bool r23887674 = r23887660 <= r23887673;
        double r23887675 = r23887667 * r23887664;
        double r23887676 = r23887665 - r23887660;
        double r23887677 = r23887675 / r23887676;
        double r23887678 = r23887663 + r23887677;
        double r23887679 = r23887667 / r23887676;
        double r23887680 = r23887664 * r23887679;
        double r23887681 = r23887680 + r23887663;
        double r23887682 = r23887674 ? r23887678 : r23887681;
        double r23887683 = r23887662 ? r23887672 : r23887682;
        return r23887683;
}

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

Derivation

  1. Split input into 3 regimes
  2. if t < -4.347512852047913

    1. Initial program 16.2

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

      \[\leadsto x + \color{blue}{\frac{y}{\frac{a - t}{z - t}}}\]
    4. Using strategy rm
    5. Applied div-sub0.1

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

    if -4.347512852047913 < t < 2.7589848075703794e-216

    1. Initial program 3.4

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

    if 2.7589848075703794e-216 < t

    1. Initial program 11.5

      \[x + \frac{y \cdot \left(z - t\right)}{a - t}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity11.5

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

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

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

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

Reproduce

herbie shell --seed 2019162 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"

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

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