Average Error: 14.8 → 0.4
Time: 24.6s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -9.22899689002624580638528949473531336394 \cdot 10^{291}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -7.773439111380205519958432372685033898185 \cdot 10^{-230}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;\frac{y}{z} \le 3.582879790863508796945436688541341859872 \cdot 10^{-315}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 6.783708578914819695819218284285454353806 \cdot 10^{197}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \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 -9.22899689002624580638528949473531336394 \cdot 10^{291}:\\
\;\;\;\;y \cdot \frac{x}{z}\\

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

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

\mathbf{elif}\;\frac{y}{z} \le 6.783708578914819695819218284285454353806 \cdot 10^{197}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r386175 = x;
        double r386176 = y;
        double r386177 = z;
        double r386178 = r386176 / r386177;
        double r386179 = t;
        double r386180 = r386178 * r386179;
        double r386181 = r386180 / r386179;
        double r386182 = r386175 * r386181;
        return r386182;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r386183 = y;
        double r386184 = z;
        double r386185 = r386183 / r386184;
        double r386186 = -9.228996890026246e+291;
        bool r386187 = r386185 <= r386186;
        double r386188 = x;
        double r386189 = r386188 / r386184;
        double r386190 = r386183 * r386189;
        double r386191 = -7.7734391113802055e-230;
        bool r386192 = r386185 <= r386191;
        double r386193 = r386184 / r386183;
        double r386194 = r386188 / r386193;
        double r386195 = 3.5828797908635e-315;
        bool r386196 = r386185 <= r386195;
        double r386197 = r386188 * r386183;
        double r386198 = r386197 / r386184;
        double r386199 = 6.78370857891482e+197;
        bool r386200 = r386185 <= r386199;
        double r386201 = r386200 ? r386194 : r386190;
        double r386202 = r386196 ? r386198 : r386201;
        double r386203 = r386192 ? r386194 : r386202;
        double r386204 = r386187 ? r386190 : r386203;
        return r386204;
}

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.8
Target1.6
Herbie0.4
\[\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) < -9.228996890026246e+291 or 6.78370857891482e+197 < (/ y z)

    1. Initial program 47.4

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

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

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

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

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

    if -9.228996890026246e+291 < (/ y z) < -7.7734391113802055e-230 or 3.5828797908635e-315 < (/ y z) < 6.78370857891482e+197

    1. Initial program 9.6

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

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

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

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

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

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

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

    if -7.7734391113802055e-230 < (/ y z) < 3.5828797908635e-315

    1. Initial program 18.4

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

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

      \[\leadsto \frac{y}{z} \cdot \color{blue}{{x}^{1}}\]
    5. Applied pow114.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -9.22899689002624580638528949473531336394 \cdot 10^{291}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -7.773439111380205519958432372685033898185 \cdot 10^{-230}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;\frac{y}{z} \le 3.582879790863508796945436688541341859872 \cdot 10^{-315}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 6.783708578914819695819218284285454353806 \cdot 10^{197}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array}\]

Reproduce

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