Average Error: 15.2 → 1.0
Time: 27.2s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -1.35613759911877656476275151503320492094 \cdot 10^{280}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -8.828782166850766038005620975563547450989 \cdot 10^{-175}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 6.939139322974091469623957424428358865557 \cdot 10^{-194}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 2.459953299034684076090573649758520228965 \cdot 10^{86}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} \le -1.35613759911877656476275151503320492094 \cdot 10^{280}:\\
\;\;\;\;y \cdot \frac{x}{z}\\

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

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

\mathbf{elif}\;\frac{y}{z} \le 2.459953299034684076090573649758520228965 \cdot 10^{86}:\\
\;\;\;\;\frac{y}{z} \cdot x\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r378314 = x;
        double r378315 = y;
        double r378316 = z;
        double r378317 = r378315 / r378316;
        double r378318 = t;
        double r378319 = r378317 * r378318;
        double r378320 = r378319 / r378318;
        double r378321 = r378314 * r378320;
        return r378321;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r378322 = y;
        double r378323 = z;
        double r378324 = r378322 / r378323;
        double r378325 = -1.3561375991187766e+280;
        bool r378326 = r378324 <= r378325;
        double r378327 = x;
        double r378328 = r378327 / r378323;
        double r378329 = r378322 * r378328;
        double r378330 = -8.828782166850766e-175;
        bool r378331 = r378324 <= r378330;
        double r378332 = r378324 * r378327;
        double r378333 = 6.939139322974091e-194;
        bool r378334 = r378324 <= r378333;
        double r378335 = r378327 * r378322;
        double r378336 = r378335 / r378323;
        double r378337 = 2.459953299034684e+86;
        bool r378338 = r378324 <= r378337;
        double r378339 = r378338 ? r378332 : r378329;
        double r378340 = r378334 ? r378336 : r378339;
        double r378341 = r378331 ? r378332 : r378340;
        double r378342 = r378326 ? r378329 : r378341;
        return r378342;
}

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

Original15.2
Target1.5
Herbie1.0
\[\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 3 regimes
  2. if (/ y z) < -1.3561375991187766e+280 or 2.459953299034684e+86 < (/ y z)

    1. Initial program 34.5

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

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

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

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

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

    if -1.3561375991187766e+280 < (/ y z) < -8.828782166850766e-175 or 6.939139322974091e-194 < (/ y z) < 2.459953299034684e+86

    1. Initial program 8.3

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

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

    if -8.828782166850766e-175 < (/ y z) < 6.939139322974091e-194

    1. Initial program 17.1

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -1.35613759911877656476275151503320492094 \cdot 10^{280}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -8.828782166850766038005620975563547450989 \cdot 10^{-175}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 6.939139322974091469623957424428358865557 \cdot 10^{-194}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 2.459953299034684076090573649758520228965 \cdot 10^{86}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019326 +o rules:numerics
(FPCore (x y z t)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, B"
  :precision binary64

  :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)))