Average Error: 6.3 → 6.1
Time: 11.9s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[x + \frac{y}{\frac{t}{z - x}}\]
x + \frac{y \cdot \left(z - x\right)}{t}
x + \frac{y}{\frac{t}{z - x}}
double f(double x, double y, double z, double t) {
        double r217252 = x;
        double r217253 = y;
        double r217254 = z;
        double r217255 = r217254 - r217252;
        double r217256 = r217253 * r217255;
        double r217257 = t;
        double r217258 = r217256 / r217257;
        double r217259 = r217252 + r217258;
        return r217259;
}

double f(double x, double y, double z, double t) {
        double r217260 = x;
        double r217261 = y;
        double r217262 = t;
        double r217263 = z;
        double r217264 = r217263 - r217260;
        double r217265 = r217262 / r217264;
        double r217266 = r217261 / r217265;
        double r217267 = r217260 + r217266;
        return r217267;
}

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

Derivation

  1. Split input into 2 regimes
  2. if x < -3.908231963040019e-294 or 4.1676572019103e-54 < x

    1. Initial program 6.8

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

      \[\leadsto x + \color{blue}{\frac{1}{\frac{t}{y \cdot \left(z - x\right)}}}\]
    4. Using strategy rm
    5. Applied div-inv6.9

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

      \[\leadsto x + \color{blue}{\frac{\frac{1}{t}}{\frac{1}{y \cdot \left(z - x\right)}}}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity7.0

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

      \[\leadsto x + \frac{\frac{1}{\color{blue}{1 \cdot t}}}{1 \cdot \frac{1}{y \cdot \left(z - x\right)}}\]
    10. Applied add-cube-cbrt7.0

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

      \[\leadsto x + \frac{\color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{t}}}{1 \cdot \frac{1}{y \cdot \left(z - x\right)}}\]
    12. Applied times-frac7.0

      \[\leadsto x + \color{blue}{\frac{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1}}{1} \cdot \frac{\frac{\sqrt[3]{1}}{t}}{\frac{1}{y \cdot \left(z - x\right)}}}\]
    13. Simplified7.0

      \[\leadsto x + \color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right)} \cdot \frac{\frac{\sqrt[3]{1}}{t}}{\frac{1}{y \cdot \left(z - x\right)}}\]
    14. Simplified1.4

      \[\leadsto x + \left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \color{blue}{\left(\left(\frac{\sqrt[3]{1}}{t} \cdot y\right) \cdot \left(z - x\right)\right)}\]
    15. Using strategy rm
    16. Applied associate-*l/1.3

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

    if -3.908231963040019e-294 < x < 4.1676572019103e-54

    1. Initial program 4.8

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

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

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

Reproduce

herbie shell --seed 2019298 
(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)))