Average Error: 6.2 → 6.2
Time: 6.3s
Precision: 64
\[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\]
\[\frac{\frac{1}{\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \left(\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot y\right)}}{x}\]
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\frac{\frac{1}{\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \left(\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot y\right)}}{x}
double f(double x, double y, double z) {
        double r290217 = 1.0;
        double r290218 = x;
        double r290219 = r290217 / r290218;
        double r290220 = y;
        double r290221 = z;
        double r290222 = r290221 * r290221;
        double r290223 = r290217 + r290222;
        double r290224 = r290220 * r290223;
        double r290225 = r290219 / r290224;
        return r290225;
}

double f(double x, double y, double z) {
        double r290226 = 1.0;
        double r290227 = z;
        double r290228 = fma(r290227, r290227, r290226);
        double r290229 = sqrt(r290228);
        double r290230 = y;
        double r290231 = r290229 * r290230;
        double r290232 = r290229 * r290231;
        double r290233 = r290226 / r290232;
        double r290234 = x;
        double r290235 = r290233 / r290234;
        return r290235;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original6.2
Target5.6
Herbie6.2
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(1 + z \cdot z\right) \lt -\infty:\\ \;\;\;\;\frac{\frac{1}{y}}{\left(1 + z \cdot z\right) \cdot x}\\ \mathbf{elif}\;y \cdot \left(1 + z \cdot z\right) \lt 8.68074325056725162 \cdot 10^{305}:\\ \;\;\;\;\frac{\frac{1}{x}}{\left(1 + z \cdot z\right) \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y}}{\left(1 + z \cdot z\right) \cdot x}\\ \end{array}\]

Derivation

  1. Initial program 6.2

    \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt6.2

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

    \[\leadsto \frac{\frac{1}{x}}{\color{blue}{\left(y \cdot \sqrt{1 + z \cdot z}\right) \cdot \sqrt{1 + z \cdot z}}}\]
  5. Simplified6.2

    \[\leadsto \frac{\frac{1}{x}}{\color{blue}{\left(\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot y\right)} \cdot \sqrt{1 + z \cdot z}}\]
  6. Using strategy rm
  7. Applied clear-num6.6

    \[\leadsto \color{blue}{\frac{1}{\frac{\left(\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot y\right) \cdot \sqrt{1 + z \cdot z}}{\frac{1}{x}}}}\]
  8. Simplified6.5

    \[\leadsto \frac{1}{\color{blue}{x \cdot \frac{\mathsf{fma}\left(z, z, 1\right) \cdot y}{1}}}\]
  9. Using strategy rm
  10. Applied div-inv6.5

    \[\leadsto \color{blue}{1 \cdot \frac{1}{x \cdot \frac{\mathsf{fma}\left(z, z, 1\right) \cdot y}{1}}}\]
  11. Simplified6.2

    \[\leadsto 1 \cdot \color{blue}{\frac{\frac{1}{\mathsf{fma}\left(z, z, 1\right) \cdot y}}{x}}\]
  12. Using strategy rm
  13. Applied add-sqr-sqrt6.2

    \[\leadsto 1 \cdot \frac{\frac{1}{\color{blue}{\left(\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \sqrt{\mathsf{fma}\left(z, z, 1\right)}\right)} \cdot y}}{x}\]
  14. Applied associate-*l*6.2

    \[\leadsto 1 \cdot \frac{\frac{1}{\color{blue}{\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \left(\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot y\right)}}}{x}\]
  15. Final simplification6.2

    \[\leadsto \frac{\frac{1}{\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot \left(\sqrt{\mathsf{fma}\left(z, z, 1\right)} \cdot y\right)}}{x}\]

Reproduce

herbie shell --seed 2020045 +o rules:numerics
(FPCore (x y z)
  :name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (if (< (* y (+ 1 (* z z))) #f) (/ (/ 1 y) (* (+ 1 (* z z)) x)) (if (< (* y (+ 1 (* z z))) 8.680743250567252e+305) (/ (/ 1 x) (* (+ 1 (* z z)) y)) (/ (/ 1 y) (* (+ 1 (* z z)) x))))

  (/ (/ 1 x) (* y (+ 1 (* z z)))))