Average Error: 12.5 → 1.4
Time: 12.4s
Precision: 64
\[\frac{x \cdot \left(y - z\right)}{y}\]
\[\begin{array}{l} \mathbf{if}\;z \le -9.212480238144806744922579169167130922594 \cdot 10^{101} \lor \neg \left(z \le 2.612548515443596481357026291817852860366 \cdot 10^{170}\right):\\ \;\;\;\;\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}}} \cdot \frac{\sqrt[3]{x}}{\frac{\sqrt[3]{y}}{\sqrt[3]{y - z}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \end{array}\]
\frac{x \cdot \left(y - z\right)}{y}
\begin{array}{l}
\mathbf{if}\;z \le -9.212480238144806744922579169167130922594 \cdot 10^{101} \lor \neg \left(z \le 2.612548515443596481357026291817852860366 \cdot 10^{170}\right):\\
\;\;\;\;\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}}} \cdot \frac{\sqrt[3]{x}}{\frac{\sqrt[3]{y}}{\sqrt[3]{y - z}}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r550011 = x;
        double r550012 = y;
        double r550013 = z;
        double r550014 = r550012 - r550013;
        double r550015 = r550011 * r550014;
        double r550016 = r550015 / r550012;
        return r550016;
}

double f(double x, double y, double z) {
        double r550017 = z;
        double r550018 = -9.212480238144807e+101;
        bool r550019 = r550017 <= r550018;
        double r550020 = 2.6125485154435965e+170;
        bool r550021 = r550017 <= r550020;
        double r550022 = !r550021;
        bool r550023 = r550019 || r550022;
        double r550024 = x;
        double r550025 = cbrt(r550024);
        double r550026 = r550025 * r550025;
        double r550027 = y;
        double r550028 = cbrt(r550027);
        double r550029 = r550028 * r550028;
        double r550030 = r550027 - r550017;
        double r550031 = cbrt(r550030);
        double r550032 = r550031 * r550031;
        double r550033 = r550029 / r550032;
        double r550034 = r550026 / r550033;
        double r550035 = r550028 / r550031;
        double r550036 = r550025 / r550035;
        double r550037 = r550034 * r550036;
        double r550038 = r550027 / r550030;
        double r550039 = r550024 / r550038;
        double r550040 = r550023 ? r550037 : r550039;
        return r550040;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original12.5
Target3.1
Herbie1.4
\[\begin{array}{l} \mathbf{if}\;z \lt -2.060202331921739024383612783691266533098 \cdot 10^{104}:\\ \;\;\;\;x - \frac{z \cdot x}{y}\\ \mathbf{elif}\;z \lt 1.693976601382852594702773997610248441465 \cdot 10^{213}:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \mathbf{else}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{x}{y}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -9.212480238144807e+101 or 2.6125485154435965e+170 < z

    1. Initial program 13.5

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

      \[\leadsto \color{blue}{\frac{x}{\frac{y}{y - z}}}\]
    4. Using strategy rm
    5. Applied add-cube-cbrt11.8

      \[\leadsto \frac{x}{\frac{y}{\color{blue}{\left(\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}\right) \cdot \sqrt[3]{y - z}}}}\]
    6. Applied add-cube-cbrt11.8

      \[\leadsto \frac{x}{\frac{\color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}}{\left(\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}\right) \cdot \sqrt[3]{y - z}}}\]
    7. Applied times-frac11.8

      \[\leadsto \frac{x}{\color{blue}{\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}} \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{y - z}}}}\]
    8. Applied add-cube-cbrt12.2

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}} \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{y - z}}}\]
    9. Applied times-frac3.1

      \[\leadsto \color{blue}{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}}} \cdot \frac{\sqrt[3]{x}}{\frac{\sqrt[3]{y}}{\sqrt[3]{y - z}}}}\]

    if -9.212480238144807e+101 < z < 2.6125485154435965e+170

    1. Initial program 12.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -9.212480238144806744922579169167130922594 \cdot 10^{101} \lor \neg \left(z \le 2.612548515443596481357026291817852860366 \cdot 10^{170}\right):\\ \;\;\;\;\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}}} \cdot \frac{\sqrt[3]{x}}{\frac{\sqrt[3]{y}}{\sqrt[3]{y - z}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019305 +o rules:numerics
(FPCore (x y z)
  :name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
  :precision binary64

  :herbie-target
  (if (< z -2.060202331921739e104) (- x (/ (* z x) y)) (if (< z 1.69397660138285259e213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))

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