Average Error: 15.3 → 6.9
Time: 8.2s
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 r454156 = x;
        double r454157 = y;
        double r454158 = z;
        double r454159 = r454157 / r454158;
        double r454160 = t;
        double r454161 = r454159 * r454160;
        double r454162 = r454161 / r454160;
        double r454163 = r454156 * r454162;
        return r454163;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r454164 = x;
        double r454165 = y;
        double r454166 = z;
        double r454167 = r454165 / r454166;
        double r454168 = r454164 * r454167;
        return r454168;
}

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.3
Target1.5
Herbie6.9
\[\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 4 regimes
  2. if (/ y z) < -1.2673089964731026e+219

    1. Initial program 44.2

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
    5. Using strategy rm
    6. Applied clear-num1.3

      \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot y}}}\]
    7. Using strategy rm
    8. Applied associate-/r*1.1

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

    if -1.2673089964731026e+219 < (/ y z) < -6.788877789726705e-200

    1. Initial program 8.3

      \[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 associate-*r/9.9

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
    5. Using strategy rm
    6. Applied associate-/l*0.3

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

    if -6.788877789726705e-200 < (/ y z) < 1.8144342740217e-313 or 3.400558014790777e+303 < (/ y z)

    1. Initial program 25.8

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

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

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

    if 1.8144342740217e-313 < (/ y z) < 3.400558014790777e+303

    1. Initial program 10.8

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

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

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

Reproduce

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