Average Error: 14.6 → 0.3
Time: 9.4s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -8.744938221735624394086083700588160422165 \cdot 10^{247}:\\ \;\;\;\;\frac{1}{\frac{\frac{z}{x}}{y}}\\ \mathbf{elif}\;\frac{y}{z} \le -4.90887845624400356201079550409662195503 \cdot 10^{-234}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 6.890799872238725235555987506188972971533 \cdot 10^{-284} \lor \neg \left(\frac{y}{z} \le 4.844168314129915218649001510512659703992 \cdot 10^{193}\right):\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} \le -8.744938221735624394086083700588160422165 \cdot 10^{247}:\\
\;\;\;\;\frac{1}{\frac{\frac{z}{x}}{y}}\\

\mathbf{elif}\;\frac{y}{z} \le -4.90887845624400356201079550409662195503 \cdot 10^{-234}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{elif}\;\frac{y}{z} \le 6.890799872238725235555987506188972971533 \cdot 10^{-284} \lor \neg \left(\frac{y}{z} \le 4.844168314129915218649001510512659703992 \cdot 10^{193}\right):\\
\;\;\;\;\frac{x}{z} \cdot y\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r445551 = x;
        double r445552 = y;
        double r445553 = z;
        double r445554 = r445552 / r445553;
        double r445555 = t;
        double r445556 = r445554 * r445555;
        double r445557 = r445556 / r445555;
        double r445558 = r445551 * r445557;
        return r445558;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r445559 = y;
        double r445560 = z;
        double r445561 = r445559 / r445560;
        double r445562 = -8.744938221735624e+247;
        bool r445563 = r445561 <= r445562;
        double r445564 = 1.0;
        double r445565 = x;
        double r445566 = r445560 / r445565;
        double r445567 = r445566 / r445559;
        double r445568 = r445564 / r445567;
        double r445569 = -4.9088784562440036e-234;
        bool r445570 = r445561 <= r445569;
        double r445571 = r445565 * r445561;
        double r445572 = 6.890799872238725e-284;
        bool r445573 = r445561 <= r445572;
        double r445574 = 4.844168314129915e+193;
        bool r445575 = r445561 <= r445574;
        double r445576 = !r445575;
        bool r445577 = r445573 || r445576;
        double r445578 = r445565 / r445560;
        double r445579 = r445578 * r445559;
        double r445580 = r445560 / r445559;
        double r445581 = r445565 / r445580;
        double r445582 = r445577 ? r445579 : r445581;
        double r445583 = r445570 ? r445571 : r445582;
        double r445584 = r445563 ? r445568 : r445583;
        return r445584;
}

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

Original14.6
Target1.6
Herbie0.3
\[\begin{array}{l} \mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \lt -1.206722051230450047215521150762600712224 \cdot 10^{245}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt -5.90752223693390632993316700759382836344 \cdot 10^{-275}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt 5.658954423153415216825328199697215652986 \cdot 10^{-65}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt 2.008718050240713347941382056648619307142 \cdot 10^{217}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot x}{z}\\ \end{array}\]

Derivation

  1. Split input into 4 regimes
  2. if (/ y z) < -8.744938221735624e+247

    1. Initial program 47.7

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Simplified0.2

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
    3. Using strategy rm
    4. Applied clear-num0.4

      \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot y}}}\]
    5. Simplified0.4

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{z}{x}}{y}}}\]

    if -8.744938221735624e+247 < (/ y z) < -4.9088784562440036e-234

    1. Initial program 9.2

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Simplified8.7

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity8.7

      \[\leadsto \frac{x \cdot y}{\color{blue}{1 \cdot z}}\]
    5. Applied times-frac0.2

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y}{z}}\]
    6. Simplified0.2

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

    if -4.9088784562440036e-234 < (/ y z) < 6.890799872238725e-284 or 4.844168314129915e+193 < (/ y z)

    1. Initial program 23.8

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Simplified0.7

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity0.7

      \[\leadsto \frac{x \cdot y}{\color{blue}{1 \cdot z}}\]
    5. Applied times-frac16.6

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y}{z}}\]
    6. Simplified16.6

      \[\leadsto \color{blue}{x} \cdot \frac{y}{z}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity16.6

      \[\leadsto \color{blue}{\left(1 \cdot x\right)} \cdot \frac{y}{z}\]
    9. Applied associate-*l*16.6

      \[\leadsto \color{blue}{1 \cdot \left(x \cdot \frac{y}{z}\right)}\]
    10. Simplified0.6

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

    if 6.890799872238725e-284 < (/ y z) < 4.844168314129915e+193

    1. Initial program 8.4

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Simplified9.3

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
    3. Using strategy rm
    4. Applied associate-/l*0.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -8.744938221735624394086083700588160422165 \cdot 10^{247}:\\ \;\;\;\;\frac{1}{\frac{\frac{z}{x}}{y}}\\ \mathbf{elif}\;\frac{y}{z} \le -4.90887845624400356201079550409662195503 \cdot 10^{-234}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 6.890799872238725235555987506188972971533 \cdot 10^{-284} \lor \neg \left(\frac{y}{z} \le 4.844168314129915218649001510512659703992 \cdot 10^{193}\right):\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019195 
(FPCore (x y z t)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, B"

  :herbie-target
  (if (< (/ (* (/ y z) t) t) -1.20672205123045e+245) (/ y (/ z x)) (if (< (/ (* (/ y z) t) t) -5.907522236933906e-275) (* x (/ y z)) (if (< (/ (* (/ y z) t) t) 5.658954423153415e-65) (/ y (/ z x)) (if (< (/ (* (/ y z) t) t) 2.0087180502407133e+217) (* x (/ y z)) (/ (* y x) z)))))

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