Average Error: 6.6 → 2.7
Time: 4.3s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \le 3.04580634147166675 \cdot 10^{-111}:\\ \;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\ \mathbf{elif}\;t \le 3.3327664558335343 \cdot 10^{135}:\\ \;\;\;\;x + y \cdot \frac{z - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{y}{t}}{\frac{1}{z - x}}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;t \le 3.04580634147166675 \cdot 10^{-111}:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\

\mathbf{elif}\;t \le 3.3327664558335343 \cdot 10^{135}:\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r395153 = x;
        double r395154 = y;
        double r395155 = z;
        double r395156 = r395155 - r395153;
        double r395157 = r395154 * r395156;
        double r395158 = t;
        double r395159 = r395157 / r395158;
        double r395160 = r395153 + r395159;
        return r395160;
}

double f(double x, double y, double z, double t) {
        double r395161 = t;
        double r395162 = 3.0458063414716667e-111;
        bool r395163 = r395161 <= r395162;
        double r395164 = x;
        double r395165 = y;
        double r395166 = r395165 / r395161;
        double r395167 = z;
        double r395168 = r395167 - r395164;
        double r395169 = r395166 * r395168;
        double r395170 = r395164 + r395169;
        double r395171 = 3.332766455833534e+135;
        bool r395172 = r395161 <= r395171;
        double r395173 = r395168 / r395161;
        double r395174 = r395165 * r395173;
        double r395175 = r395164 + r395174;
        double r395176 = 1.0;
        double r395177 = r395176 / r395168;
        double r395178 = r395166 / r395177;
        double r395179 = r395164 + r395178;
        double r395180 = r395172 ? r395175 : r395179;
        double r395181 = r395163 ? r395170 : r395180;
        return r395181;
}

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.2
Herbie2.7
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)\]

Derivation

  1. Split input into 3 regimes
  2. if t < 3.0458063414716667e-111

    1. Initial program 5.8

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

      \[\leadsto x + \color{blue}{\frac{y}{\frac{t}{z - x}}}\]
    4. Using strategy rm
    5. Applied associate-/r/2.8

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

    if 3.0458063414716667e-111 < t < 3.332766455833534e+135

    1. Initial program 3.4

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

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

      \[\leadsto x + \color{blue}{\frac{y}{1} \cdot \frac{z - x}{t}}\]
    5. Simplified3.6

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

    if 3.332766455833534e+135 < t

    1. Initial program 12.9

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

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

      \[\leadsto x + \frac{y}{\color{blue}{t \cdot \frac{1}{z - x}}}\]
    6. Applied associate-/r*1.3

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

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

Reproduce

herbie shell --seed 2020036 
(FPCore (x y z t)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
  :precision binary64

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

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