Average Error: 6.6 → 2.0
Time: 16.6s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -9.852890509116222848050724694861166428098 \cdot 10^{81}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \mathbf{elif}\;t \le 2.942943357684918171837105411485170952589 \cdot 10^{-100}:\\ \;\;\;\;\left(\left(z - x\right) \cdot y\right) \cdot \frac{1}{t} + x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;t \le -9.852890509116222848050724694861166428098 \cdot 10^{81}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\

\mathbf{elif}\;t \le 2.942943357684918171837105411485170952589 \cdot 10^{-100}:\\
\;\;\;\;\left(\left(z - x\right) \cdot y\right) \cdot \frac{1}{t} + x\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r14092889 = x;
        double r14092890 = y;
        double r14092891 = z;
        double r14092892 = r14092891 - r14092889;
        double r14092893 = r14092890 * r14092892;
        double r14092894 = t;
        double r14092895 = r14092893 / r14092894;
        double r14092896 = r14092889 + r14092895;
        return r14092896;
}

double f(double x, double y, double z, double t) {
        double r14092897 = t;
        double r14092898 = -9.852890509116223e+81;
        bool r14092899 = r14092897 <= r14092898;
        double r14092900 = x;
        double r14092901 = y;
        double r14092902 = z;
        double r14092903 = r14092902 - r14092900;
        double r14092904 = r14092897 / r14092903;
        double r14092905 = r14092901 / r14092904;
        double r14092906 = r14092900 + r14092905;
        double r14092907 = 2.942943357684918e-100;
        bool r14092908 = r14092897 <= r14092907;
        double r14092909 = r14092903 * r14092901;
        double r14092910 = 1.0;
        double r14092911 = r14092910 / r14092897;
        double r14092912 = r14092909 * r14092911;
        double r14092913 = r14092912 + r14092900;
        double r14092914 = r14092908 ? r14092913 : r14092906;
        double r14092915 = r14092899 ? r14092906 : r14092914;
        return r14092915;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.6
Target2.0
Herbie2.0
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)\]

Derivation

  1. Split input into 2 regimes
  2. if t < -9.852890509116223e+81 or 2.942943357684918e-100 < t

    1. Initial program 8.9

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

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

    if -9.852890509116223e+81 < t < 2.942943357684918e-100

    1. Initial program 2.7

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Using strategy rm
    3. Applied div-inv2.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -9.852890509116222848050724694861166428098 \cdot 10^{81}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \mathbf{elif}\;t \le 2.942943357684918171837105411485170952589 \cdot 10^{-100}:\\ \;\;\;\;\left(\left(z - x\right) \cdot y\right) \cdot \frac{1}{t} + x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019192 +o rules:numerics
(FPCore (x y z t)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"

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

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