Average Error: 15.3 → 0.7
Time: 9.5s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -1.548240730790440881436662006949490760264 \cdot 10^{219}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -1.442433262831919710603838797359517016977 \cdot 10^{-140}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le -0.0 \lor \neg \left(\frac{y}{z} \le 2.381732747802579320943017921487277387689 \cdot 10^{244}\right):\\ \;\;\;\;y \cdot \frac{x}{z}\\ \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 -1.548240730790440881436662006949490760264 \cdot 10^{219}:\\
\;\;\;\;y \cdot \frac{x}{z}\\

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

\mathbf{elif}\;\frac{y}{z} \le -0.0 \lor \neg \left(\frac{y}{z} \le 2.381732747802579320943017921487277387689 \cdot 10^{244}\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r384642 = x;
        double r384643 = y;
        double r384644 = z;
        double r384645 = r384643 / r384644;
        double r384646 = t;
        double r384647 = r384645 * r384646;
        double r384648 = r384647 / r384646;
        double r384649 = r384642 * r384648;
        return r384649;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r384650 = y;
        double r384651 = z;
        double r384652 = r384650 / r384651;
        double r384653 = -1.548240730790441e+219;
        bool r384654 = r384652 <= r384653;
        double r384655 = x;
        double r384656 = r384655 / r384651;
        double r384657 = r384650 * r384656;
        double r384658 = -1.4424332628319197e-140;
        bool r384659 = r384652 <= r384658;
        double r384660 = r384652 * r384655;
        double r384661 = -0.0;
        bool r384662 = r384652 <= r384661;
        double r384663 = 2.3817327478025793e+244;
        bool r384664 = r384652 <= r384663;
        double r384665 = !r384664;
        bool r384666 = r384662 || r384665;
        double r384667 = r384651 / r384650;
        double r384668 = r384655 / r384667;
        double r384669 = r384666 ? r384657 : r384668;
        double r384670 = r384659 ? r384660 : r384669;
        double r384671 = r384654 ? r384657 : r384670;
        return r384671;
}

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.3
Target1.6
Herbie0.7
\[\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.548240730790441e+219 or -1.4424332628319197e-140 < (/ y z) < -0.0 or 2.3817327478025793e+244 < (/ y z)

    1. Initial program 25.6

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

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

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

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

      \[\leadsto \color{blue}{x} \cdot \frac{y}{z}\]
    7. Using strategy rm
    8. Applied pow116.9

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

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

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

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

    if -1.548240730790441e+219 < (/ y z) < -1.4424332628319197e-140

    1. Initial program 8.5

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

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

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

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

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

    if -0.0 < (/ y z) < 2.3817327478025793e+244

    1. Initial program 10.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -1.548240730790440881436662006949490760264 \cdot 10^{219}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -1.442433262831919710603838797359517016977 \cdot 10^{-140}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le -0.0 \lor \neg \left(\frac{y}{z} \le 2.381732747802579320943017921487277387689 \cdot 10^{244}\right):\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]

Reproduce

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