Average Error: 14.6 → 1.8
Time: 9.1s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \le -7.657111701178940777012861820082087700041 \cdot 10^{198}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \le -2.546781552442980009772678360076582367412 \cdot 10^{-137}:\\ \;\;\;\;x \cdot \frac{\frac{y}{z} \cdot t}{t}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \le 5.245049798274293957912975359369120889594 \cdot 10^{-102}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \le 1.983801995551396888093353762194298415423 \cdot 10^{200}:\\ \;\;\;\;x \cdot \frac{\frac{y}{z} \cdot t}{t}\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{z}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \le -7.657111701178940777012861820082087700041 \cdot 10^{198}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\

\mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \le -2.546781552442980009772678360076582367412 \cdot 10^{-137}:\\
\;\;\;\;x \cdot \frac{\frac{y}{z} \cdot t}{t}\\

\mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \le 5.245049798274293957912975359369120889594 \cdot 10^{-102}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\

\mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \le 1.983801995551396888093353762194298415423 \cdot 10^{200}:\\
\;\;\;\;x \cdot \frac{\frac{y}{z} \cdot t}{t}\\

\mathbf{else}:\\
\;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{z}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r416471 = x;
        double r416472 = y;
        double r416473 = z;
        double r416474 = r416472 / r416473;
        double r416475 = t;
        double r416476 = r416474 * r416475;
        double r416477 = r416476 / r416475;
        double r416478 = r416471 * r416477;
        return r416478;
}

double f(double x, double y, double z, double t) {
        double r416479 = y;
        double r416480 = z;
        double r416481 = r416479 / r416480;
        double r416482 = t;
        double r416483 = r416481 * r416482;
        double r416484 = r416483 / r416482;
        double r416485 = -7.657111701178941e+198;
        bool r416486 = r416484 <= r416485;
        double r416487 = x;
        double r416488 = r416480 / r416487;
        double r416489 = r416479 / r416488;
        double r416490 = -2.54678155244298e-137;
        bool r416491 = r416484 <= r416490;
        double r416492 = r416487 * r416484;
        double r416493 = 5.245049798274294e-102;
        bool r416494 = r416484 <= r416493;
        double r416495 = 1.983801995551397e+200;
        bool r416496 = r416484 <= r416495;
        double r416497 = r416479 * r416487;
        double r416498 = 1.0;
        double r416499 = r416498 / r416480;
        double r416500 = r416497 * r416499;
        double r416501 = r416496 ? r416492 : r416500;
        double r416502 = r416494 ? r416489 : r416501;
        double r416503 = r416491 ? r416492 : r416502;
        double r416504 = r416486 ? r416489 : r416503;
        return r416504;
}

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.5
Herbie1.8
\[\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) t) t) < -7.657111701178941e+198 or -2.54678155244298e-137 < (/ (* (/ y z) t) t) < 5.245049798274294e-102

    1. Initial program 21.8

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

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

      \[\leadsto \color{blue}{\left(y \cdot x\right) \cdot \frac{1}{z}}\]
    5. Using strategy rm
    6. Applied pow12.3

      \[\leadsto \left(y \cdot x\right) \cdot \color{blue}{{\left(\frac{1}{z}\right)}^{1}}\]
    7. Applied pow12.3

      \[\leadsto \left(y \cdot \color{blue}{{x}^{1}}\right) \cdot {\left(\frac{1}{z}\right)}^{1}\]
    8. Applied pow12.3

      \[\leadsto \left(\color{blue}{{y}^{1}} \cdot {x}^{1}\right) \cdot {\left(\frac{1}{z}\right)}^{1}\]
    9. Applied pow-prod-down2.3

      \[\leadsto \color{blue}{{\left(y \cdot x\right)}^{1}} \cdot {\left(\frac{1}{z}\right)}^{1}\]
    10. Applied pow-prod-down2.3

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

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

    if -7.657111701178941e+198 < (/ (* (/ y z) t) t) < -2.54678155244298e-137 or 5.245049798274294e-102 < (/ (* (/ y z) t) t) < 1.983801995551397e+200

    1. Initial program 0.6

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]

    if 1.983801995551397e+200 < (/ (* (/ y z) t) t)

    1. Initial program 46.2

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \le -7.657111701178940777012861820082087700041 \cdot 10^{198}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \le -2.546781552442980009772678360076582367412 \cdot 10^{-137}:\\ \;\;\;\;x \cdot \frac{\frac{y}{z} \cdot t}{t}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \le 5.245049798274293957912975359369120889594 \cdot 10^{-102}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \le 1.983801995551396888093353762194298415423 \cdot 10^{200}:\\ \;\;\;\;x \cdot \frac{\frac{y}{z} \cdot t}{t}\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019212 
(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.20672205123045005e245) (/ y (/ z x)) (if (< (/ (* (/ y z) t) t) -5.90752223693390633e-275) (* x (/ y z)) (if (< (/ (* (/ y z) t) t) 5.65895442315341522e-65) (/ y (/ z x)) (if (< (/ (* (/ y z) t) t) 2.0087180502407133e217) (* x (/ y z)) (/ (* y x) z)))))

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