Average Error: 6.2 → 5.1
Time: 4.9s
Precision: 64
\[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(1 + z \cdot z\right) \le 1.99426338026531584 \cdot 10^{307}:\\ \;\;\;\;\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt[3]{x} \cdot \sqrt[3]{x}}}{\frac{\left(\left({\left({y}^{\frac{1}{3}}\right)}^{3} \cdot z\right) \cdot z + 1 \cdot {\left({y}^{\frac{1}{3}}\right)}^{3}\right) \cdot \sqrt[3]{x}}{\sqrt[3]{1}}}\\ \end{array}\]
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\begin{array}{l}
\mathbf{if}\;y \cdot \left(1 + z \cdot z\right) \le 1.99426338026531584 \cdot 10^{307}:\\
\;\;\;\;\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt[3]{x} \cdot \sqrt[3]{x}}}{\frac{\left(\left({\left({y}^{\frac{1}{3}}\right)}^{3} \cdot z\right) \cdot z + 1 \cdot {\left({y}^{\frac{1}{3}}\right)}^{3}\right) \cdot \sqrt[3]{x}}{\sqrt[3]{1}}}\\

\end{array}
double code(double x, double y, double z) {
	return ((1.0 / x) / (y * (1.0 + (z * z))));
}
double code(double x, double y, double z) {
	double VAR;
	if (((y * (1.0 + (z * z))) <= 1.9942633802653158e+307)) {
		VAR = ((1.0 / x) / (y * (1.0 + (z * z))));
	} else {
		VAR = (((cbrt(1.0) * cbrt(1.0)) / (cbrt(x) * cbrt(x))) / (((((pow(pow(y, 0.3333333333333333), 3.0) * z) * z) + (1.0 * pow(pow(y, 0.3333333333333333), 3.0))) * cbrt(x)) / cbrt(1.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.2
Target5.5
Herbie5.1
\[\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. Split input into 2 regimes
  2. if (* y (+ 1.0 (* z z))) < 1.9942633802653158e+307

    1. Initial program 3.9

      \[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\]

    if 1.9942633802653158e+307 < (* y (+ 1.0 (* z z)))

    1. Initial program 18.0

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt[3]{x} \cdot \sqrt[3]{x}} \cdot \frac{\sqrt[3]{1}}{\sqrt[3]{x}}}}{y \cdot \left(1 + z \cdot z\right)}\]
    6. Applied associate-/l*18.0

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

      \[\leadsto \frac{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt[3]{x} \cdot \sqrt[3]{x}}}{\color{blue}{\frac{\left(y \cdot \mathsf{fma}\left(z, z, 1\right)\right) \cdot \sqrt[3]{x}}{\sqrt[3]{1}}}}\]
    8. Using strategy rm
    9. Applied add-cube-cbrt18.0

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

      \[\leadsto \frac{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt[3]{x} \cdot \sqrt[3]{x}}}{\frac{\color{blue}{\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(\sqrt[3]{y} \cdot \mathsf{fma}\left(z, z, 1\right)\right)\right)} \cdot \sqrt[3]{x}}{\sqrt[3]{1}}}\]
    11. Using strategy rm
    12. Applied fma-udef18.0

      \[\leadsto \frac{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt[3]{x} \cdot \sqrt[3]{x}}}{\frac{\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(\sqrt[3]{y} \cdot \color{blue}{\left(z \cdot z + 1\right)}\right)\right) \cdot \sqrt[3]{x}}{\sqrt[3]{1}}}\]
    13. Applied distribute-lft-in18.0

      \[\leadsto \frac{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt[3]{x} \cdot \sqrt[3]{x}}}{\frac{\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \color{blue}{\left(\sqrt[3]{y} \cdot \left(z \cdot z\right) + \sqrt[3]{y} \cdot 1\right)}\right) \cdot \sqrt[3]{x}}{\sqrt[3]{1}}}\]
    14. Applied distribute-lft-in18.0

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

      \[\leadsto \frac{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt[3]{x} \cdot \sqrt[3]{x}}}{\frac{\left(\color{blue}{\left({\left({y}^{\frac{1}{3}}\right)}^{3} \cdot z\right) \cdot z} + \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(\sqrt[3]{y} \cdot 1\right)\right) \cdot \sqrt[3]{x}}{\sqrt[3]{1}}}\]
    16. Simplified11.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(1 + z \cdot z\right) \le 1.99426338026531584 \cdot 10^{307}:\\ \;\;\;\;\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt[3]{x} \cdot \sqrt[3]{x}}}{\frac{\left(\left({\left({y}^{\frac{1}{3}}\right)}^{3} \cdot z\right) \cdot z + 1 \cdot {\left({y}^{\frac{1}{3}}\right)}^{3}\right) \cdot \sqrt[3]{x}}{\sqrt[3]{1}}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020092 +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)))))