Average Error: 15.4 → 1.0
Time: 13.4s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -1.057433920064963 \cdot 10^{133}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\ \mathbf{elif}\;\frac{y}{z} \le -1.0665637347194774 \cdot 10^{-221} \lor \neg \left(\frac{y}{z} \le 1.5828563463705101 \cdot 10^{-127}\right) \land \frac{y}{z} \le 2.5905951762285947 \cdot 10^{176}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} \le -1.057433920064963 \cdot 10^{133}:\\
\;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\

\mathbf{elif}\;\frac{y}{z} \le -1.0665637347194774 \cdot 10^{-221} \lor \neg \left(\frac{y}{z} \le 1.5828563463705101 \cdot 10^{-127}\right) \land \frac{y}{z} \le 2.5905951762285947 \cdot 10^{176}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r669940 = x;
        double r669941 = y;
        double r669942 = z;
        double r669943 = r669941 / r669942;
        double r669944 = t;
        double r669945 = r669943 * r669944;
        double r669946 = r669945 / r669944;
        double r669947 = r669940 * r669946;
        return r669947;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r669948 = y;
        double r669949 = z;
        double r669950 = r669948 / r669949;
        double r669951 = -1.057433920064963e+133;
        bool r669952 = r669950 <= r669951;
        double r669953 = 1.0;
        double r669954 = x;
        double r669955 = r669954 * r669948;
        double r669956 = r669949 / r669955;
        double r669957 = r669953 / r669956;
        double r669958 = -1.0665637347194774e-221;
        bool r669959 = r669950 <= r669958;
        double r669960 = 1.5828563463705101e-127;
        bool r669961 = r669950 <= r669960;
        double r669962 = !r669961;
        double r669963 = 2.5905951762285947e+176;
        bool r669964 = r669950 <= r669963;
        bool r669965 = r669962 && r669964;
        bool r669966 = r669959 || r669965;
        double r669967 = r669949 / r669948;
        double r669968 = r669954 / r669967;
        double r669969 = r669955 / r669949;
        double r669970 = r669966 ? r669968 : r669969;
        double r669971 = r669952 ? r669957 : r669970;
        return r669971;
}

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.4
Target1.5
Herbie1.0
\[\begin{array}{l} \mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \lt -1.20672205123045005 \cdot 10^{245}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt -5.90752223693390633 \cdot 10^{-275}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt 5.65895442315341522 \cdot 10^{-65}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt 2.0087180502407133 \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.057433920064963e+133

    1. Initial program 34.0

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(\frac{x \cdot y}{z}\right)}}^{1}\]
    8. Using strategy rm
    9. Applied clear-num4.1

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

    if -1.057433920064963e+133 < (/ y z) < -1.0665637347194774e-221 or 1.5828563463705101e-127 < (/ y z) < 2.5905951762285947e+176

    1. Initial program 6.8

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(\frac{x \cdot y}{z}\right)}}^{1}\]
    8. Using strategy rm
    9. Applied associate-/l*0.2

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

    if -1.0665637347194774e-221 < (/ y z) < 1.5828563463705101e-127 or 2.5905951762285947e+176 < (/ y z)

    1. Initial program 22.0

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -1.057433920064963 \cdot 10^{133}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\ \mathbf{elif}\;\frac{y}{z} \le -1.0665637347194774 \cdot 10^{-221} \lor \neg \left(\frac{y}{z} \le 1.5828563463705101 \cdot 10^{-127}\right) \land \frac{y}{z} \le 2.5905951762285947 \cdot 10^{176}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

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