Average Error: 14.0 → 6.3
Time: 13.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 r437865 = x;
        double r437866 = y;
        double r437867 = z;
        double r437868 = r437866 / r437867;
        double r437869 = t;
        double r437870 = r437868 * r437869;
        double r437871 = r437870 / r437869;
        double r437872 = r437865 * r437871;
        return r437872;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r437873 = x;
        double r437874 = y;
        double r437875 = z;
        double r437876 = r437874 / r437875;
        double r437877 = r437873 * r437876;
        return r437877;
}

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.0
Target1.4
Herbie6.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 2 regimes
  2. if (/ y z) < -inf.0 or -1.9001417427877727e-270 < (/ y z) < 1.9873965595470336e-307 or 1.0511610758752524e+156 < (/ y z)

    1. Initial program 27.6

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

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

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

    if -inf.0 < (/ y z) < -1.9001417427877727e-270 or 1.9873965595470336e-307 < (/ y z) < 1.0511610758752524e+156

    1. Initial program 8.6

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

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

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

Reproduce

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