Average Error: 14.7 → 0.3
Time: 8.5s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -6.29544524415545219149038523268139908958 \cdot 10^{285}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -1.575588880456927846517204610144689059531 \cdot 10^{-286}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;\frac{y}{z} \le 3.757059281014894097749857788400547545613 \cdot 10^{-220}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 1.409130514825537046443418609777720419861 \cdot 10^{217}:\\ \;\;\;\;\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 -6.29544524415545219149038523268139908958 \cdot 10^{285}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\

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

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

\mathbf{elif}\;\frac{y}{z} \le 1.409130514825537046443418609777720419861 \cdot 10^{217}:\\
\;\;\;\;\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 r494641 = x;
        double r494642 = y;
        double r494643 = z;
        double r494644 = r494642 / r494643;
        double r494645 = t;
        double r494646 = r494644 * r494645;
        double r494647 = r494646 / r494645;
        double r494648 = r494641 * r494647;
        return r494648;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r494649 = y;
        double r494650 = z;
        double r494651 = r494649 / r494650;
        double r494652 = -6.295445244155452e+285;
        bool r494653 = r494651 <= r494652;
        double r494654 = x;
        double r494655 = r494654 * r494649;
        double r494656 = 1.0;
        double r494657 = r494656 / r494650;
        double r494658 = r494655 * r494657;
        double r494659 = -1.5755888804569278e-286;
        bool r494660 = r494651 <= r494659;
        double r494661 = r494650 / r494649;
        double r494662 = r494654 / r494661;
        double r494663 = 3.757059281014894e-220;
        bool r494664 = r494651 <= r494663;
        double r494665 = r494655 / r494650;
        double r494666 = 1.409130514825537e+217;
        bool r494667 = r494651 <= r494666;
        double r494668 = r494651 * r494654;
        double r494669 = r494654 / r494650;
        double r494670 = r494649 * r494669;
        double r494671 = r494667 ? r494668 : r494670;
        double r494672 = r494664 ? r494665 : r494671;
        double r494673 = r494660 ? r494662 : r494672;
        double r494674 = r494653 ? r494658 : r494673;
        return r494674;
}

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.7
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 5 regimes
  2. if (/ y z) < -6.295445244155452e+285

    1. Initial program 58.1

      \[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 div-inv0.3

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

    if -6.295445244155452e+285 < (/ y z) < -1.5755888804569278e-286

    1. Initial program 10.7

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

      \[\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}}}\]

    if -1.5755888804569278e-286 < (/ y z) < 3.757059281014894e-220

    1. Initial program 18.8

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
    5. Taylor expanded around 0 0.3

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

    if 3.757059281014894e-220 < (/ y z) < 1.409130514825537e+217

    1. Initial program 8.1

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

      \[\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}}}\]
    5. Taylor expanded around 0 9.2

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

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

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

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

    if 1.409130514825537e+217 < (/ y z)

    1. Initial program 44.0

      \[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 associate-/l*29.0

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
    5. Taylor expanded around 0 1.0

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
    6. Taylor expanded around 0 1.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -6.29544524415545219149038523268139908958 \cdot 10^{285}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -1.575588880456927846517204610144689059531 \cdot 10^{-286}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;\frac{y}{z} \le 3.757059281014894097749857788400547545613 \cdot 10^{-220}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 1.409130514825537046443418609777720419861 \cdot 10^{217}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array}\]

Reproduce

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