Average Error: 6.5 → 3.7
Time: 5.0s
Precision: binary64
\[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \cdot z \leq 7.785649327947097 \cdot 10^{+159}:\\ \;\;\;\;\frac{\frac{\frac{1}{x}}{z \cdot z + 1}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x \cdot \left(z \cdot \left(z \cdot y\right)\right)} - \frac{1}{x \cdot \left(y \cdot {z}^{4}\right)}\\ \end{array}\]
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 7.785649327947097 \cdot 10^{+159}:\\
\;\;\;\;\frac{\frac{\frac{1}{x}}{z \cdot z + 1}}{y}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(z \cdot \left(z \cdot y\right)\right)} - \frac{1}{x \cdot \left(y \cdot {z}^{4}\right)}\\

\end{array}
double code(double x, double y, double z) {
	return ((1.0 / x) / ((double) (y * ((double) (1.0 + ((double) (z * z)))))));
}
double code(double x, double y, double z) {
	double VAR;
	if ((((double) (z * z)) <= 7.785649327947097e+159)) {
		VAR = (((1.0 / x) / ((double) (((double) (z * z)) + 1.0))) / y);
	} else {
		VAR = ((double) ((1.0 / ((double) (x * ((double) (z * ((double) (z * y))))))) - (1.0 / ((double) (x * ((double) (y * ((double) pow(z, 4.0)))))))));
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.5
Target5.7
Herbie3.7
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(1 + z \cdot z\right) < -\infty:\\ \;\;\;\;\frac{\frac{1}{y}}{\left(1 + z \cdot z\right) \cdot x}\\ \mathbf{elif}\;y \cdot \left(1 + z \cdot z\right) < 8.680743250567252 \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. Split input into 2 regimes
  2. if (* z z) < 7.78564932794709679e159

    1. Initial program 1.0

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

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{\frac{1}{x}} \cdot \sqrt[3]{\frac{1}{x}}}{y} \cdot \frac{\sqrt[3]{\frac{1}{x}}}{1 + z \cdot z}}\]
    5. Simplified1.4

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{\frac{1}{x}} \cdot \sqrt[3]{\frac{1}{x}}}{y}} \cdot \frac{\sqrt[3]{\frac{1}{x}}}{1 + z \cdot z}\]
    8. Applied associate-*l/1.8

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

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

    if 7.78564932794709679e159 < (* z z)

    1. Initial program 14.5

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

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{\frac{1}{x}} \cdot \sqrt[3]{\frac{1}{x}}}{y} \cdot \frac{\sqrt[3]{\frac{1}{x}}}{1 + z \cdot z}}\]
    5. Simplified14.3

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{1}{x}} \cdot \frac{\sqrt[3]{\frac{1}{x}}}{y}\right)} \cdot \frac{\sqrt[3]{\frac{1}{x}}}{1 + z \cdot z}\]
    6. Using strategy rm
    7. Applied associate-*r/14.3

      \[\leadsto \color{blue}{\frac{\sqrt[3]{\frac{1}{x}} \cdot \sqrt[3]{\frac{1}{x}}}{y}} \cdot \frac{\sqrt[3]{\frac{1}{x}}}{1 + z \cdot z}\]
    8. Applied associate-*l/14.1

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

      \[\leadsto \frac{\color{blue}{\frac{\frac{1}{x}}{1 + z \cdot z}}}{y}\]
    10. Taylor expanded around inf 14.6

      \[\leadsto \color{blue}{1 \cdot \frac{1}{x \cdot \left({z}^{2} \cdot y\right)} - 1 \cdot \frac{1}{x \cdot \left({z}^{4} \cdot y\right)}}\]
    11. Simplified7.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \leq 7.785649327947097 \cdot 10^{+159}:\\ \;\;\;\;\frac{\frac{\frac{1}{x}}{z \cdot z + 1}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x \cdot \left(z \cdot \left(z \cdot y\right)\right)} - \frac{1}{x \cdot \left(y \cdot {z}^{4}\right)}\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< (* y (+ 1.0 (* z z))) (- INFINITY)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x)) (if (< (* y (+ 1.0 (* z z))) 8.680743250567252e+305) (/ (/ 1.0 x) (* (+ 1.0 (* z z)) y)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x))))

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