Average Error: 14.5 → 6.2
Time: 9.3s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[x \cdot \frac{y}{z}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
x \cdot \frac{y}{z}
double f(double x, double y, double z, double t) {
        double r363840 = x;
        double r363841 = y;
        double r363842 = z;
        double r363843 = r363841 / r363842;
        double r363844 = t;
        double r363845 = r363843 * r363844;
        double r363846 = r363845 / r363844;
        double r363847 = r363840 * r363846;
        return r363847;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r363848 = x;
        double r363849 = y;
        double r363850 = z;
        double r363851 = r363849 / r363850;
        double r363852 = r363848 * r363851;
        return r363852;
}

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.5
Target1.7
Herbie6.2
\[\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) < 2.9568082620179477e-170

    1. Initial program 14.6

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

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

      \[\leadsto x \cdot \frac{y}{\color{blue}{1 \cdot z}}\]
    5. Applied add-cube-cbrt7.4

      \[\leadsto x \cdot \frac{\color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}}{1 \cdot z}\]
    6. Applied times-frac7.4

      \[\leadsto x \cdot \color{blue}{\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1} \cdot \frac{\sqrt[3]{y}}{z}\right)}\]
    7. Applied associate-*r*5.0

      \[\leadsto \color{blue}{\left(x \cdot \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1}\right) \cdot \frac{\sqrt[3]{y}}{z}}\]
    8. Simplified5.0

      \[\leadsto \color{blue}{\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot x\right)} \cdot \frac{\sqrt[3]{y}}{z}\]
    9. Using strategy rm
    10. Applied associate-*r/5.9

      \[\leadsto \color{blue}{\frac{\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot x\right) \cdot \sqrt[3]{y}}{z}}\]
    11. Simplified5.1

      \[\leadsto \frac{\color{blue}{y \cdot x}}{z}\]
    12. Using strategy rm
    13. Applied *-un-lft-identity5.1

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

      \[\leadsto \color{blue}{\frac{y}{1} \cdot \frac{x}{z}}\]
    15. Simplified4.8

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

    if 2.9568082620179477e-170 < (/ y z) < 1.2283202023430539e+235

    1. Initial program 9.2

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

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

    if 1.2283202023430539e+235 < (/ y z)

    1. Initial program 46.0

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

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

      \[\leadsto x \cdot \frac{y}{\color{blue}{1 \cdot z}}\]
    5. Applied add-cube-cbrt35.9

      \[\leadsto x \cdot \frac{\color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}}{1 \cdot z}\]
    6. Applied times-frac35.9

      \[\leadsto x \cdot \color{blue}{\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1} \cdot \frac{\sqrt[3]{y}}{z}\right)}\]
    7. Applied associate-*r*9.4

      \[\leadsto \color{blue}{\left(x \cdot \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1}\right) \cdot \frac{\sqrt[3]{y}}{z}}\]
    8. Simplified9.4

      \[\leadsto \color{blue}{\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot x\right)} \cdot \frac{\sqrt[3]{y}}{z}\]
    9. Using strategy rm
    10. Applied associate-*r/1.4

      \[\leadsto \color{blue}{\frac{\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot x\right) \cdot \sqrt[3]{y}}{z}}\]
    11. Simplified0.4

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

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

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

Reproduce

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