
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 / x) / (y * (1.0d0 + (z * z)))
end function
public static double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
def code(x, y, z): return (1.0 / x) / (y * (1.0 + (z * z)))
function code(x, y, z) return Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))) end
function tmp = code(x, y, z) tmp = (1.0 / x) / (y * (1.0 + (z * z))); end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 / x) / (y * (1.0d0 + (z * z)))
end function
public static double code(double x, double y, double z) {
return (1.0 / x) / (y * (1.0 + (z * z)));
}
def code(x, y, z): return (1.0 / x) / (y * (1.0 + (z * z)))
function code(x, y, z) return Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))) end
function tmp = code(x, y, z) tmp = (1.0 / x) / (y * (1.0 + (z * z))); end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\end{array}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (hypot 1.0 z) (sqrt y))))
(if (<= (* y (+ 1.0 (* z z))) 2e-231)
(pow (/ (hypot 1.0 z) (/ 1.0 (* y (* (hypot 1.0 z) x)))) -1.0)
(* (/ (/ 1.0 x) t_0) (/ 1.0 t_0)))))
double code(double x, double y, double z) {
double t_0 = hypot(1.0, z) * sqrt(y);
double tmp;
if ((y * (1.0 + (z * z))) <= 2e-231) {
tmp = pow((hypot(1.0, z) / (1.0 / (y * (hypot(1.0, z) * x)))), -1.0);
} else {
tmp = ((1.0 / x) / t_0) * (1.0 / t_0);
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = Math.hypot(1.0, z) * Math.sqrt(y);
double tmp;
if ((y * (1.0 + (z * z))) <= 2e-231) {
tmp = Math.pow((Math.hypot(1.0, z) / (1.0 / (y * (Math.hypot(1.0, z) * x)))), -1.0);
} else {
tmp = ((1.0 / x) / t_0) * (1.0 / t_0);
}
return tmp;
}
def code(x, y, z): t_0 = math.hypot(1.0, z) * math.sqrt(y) tmp = 0 if (y * (1.0 + (z * z))) <= 2e-231: tmp = math.pow((math.hypot(1.0, z) / (1.0 / (y * (math.hypot(1.0, z) * x)))), -1.0) else: tmp = ((1.0 / x) / t_0) * (1.0 / t_0) return tmp
function code(x, y, z) t_0 = Float64(hypot(1.0, z) * sqrt(y)) tmp = 0.0 if (Float64(y * Float64(1.0 + Float64(z * z))) <= 2e-231) tmp = Float64(hypot(1.0, z) / Float64(1.0 / Float64(y * Float64(hypot(1.0, z) * x)))) ^ -1.0; else tmp = Float64(Float64(Float64(1.0 / x) / t_0) * Float64(1.0 / t_0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = hypot(1.0, z) * sqrt(y); tmp = 0.0; if ((y * (1.0 + (z * z))) <= 2e-231) tmp = (hypot(1.0, z) / (1.0 / (y * (hypot(1.0, z) * x)))) ^ -1.0; else tmp = ((1.0 / x) / t_0) * (1.0 / t_0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e-231], N[Power[N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] / N[(1.0 / N[(y * N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] / t$95$0), $MachinePrecision] * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(1, z\right) \cdot \sqrt{y}\\
\mathbf{if}\;y \cdot \left(1 + z \cdot z\right) \leq 2 \cdot 10^{-231}:\\
\;\;\;\;{\left(\frac{\mathsf{hypot}\left(1, z\right)}{\frac{1}{y \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot x\right)}}\right)}^{-1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{t_0} \cdot \frac{1}{t_0}\\
\end{array}
\end{array}
if (*.f64 y (+.f64 1 (*.f64 z z))) < 2e-231Initial program 93.7%
associate-/r*93.7%
+-commutative93.7%
fma-def93.7%
Simplified93.7%
fma-udef93.7%
+-commutative93.7%
associate-/r*93.7%
associate-/r*94.9%
add-sqr-sqrt94.9%
*-un-lft-identity94.9%
times-frac94.9%
hypot-1-def94.9%
associate-/l/94.9%
hypot-1-def96.3%
Applied egg-rr96.3%
associate-*l/96.4%
*-lft-identity96.4%
associate-/r*96.3%
associate-/l/99.1%
*-commutative99.1%
Simplified99.1%
clear-num99.0%
inv-pow99.0%
div-inv99.0%
frac-times99.1%
metadata-eval99.1%
Applied egg-rr99.1%
if 2e-231 < (*.f64 y (+.f64 1 (*.f64 z z))) Initial program 88.6%
associate-/r*88.6%
+-commutative88.6%
fma-def88.6%
Simplified88.6%
associate-/r*88.6%
*-un-lft-identity88.6%
fma-udef88.6%
+-commutative88.6%
add-sqr-sqrt88.4%
times-frac88.4%
sqrt-prod88.4%
hypot-1-def88.4%
sqrt-prod89.9%
hypot-1-def99.3%
Applied egg-rr99.3%
*-commutative99.3%
Simplified99.3%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (<= x -4e+29) (/ (/ -1.0 (* y (- x))) (+ 1.0 (* z z))) (/ (/ 1.0 y) (* (hypot 1.0 z) (* (hypot 1.0 z) x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -4e+29) {
tmp = (-1.0 / (y * -x)) / (1.0 + (z * z));
} else {
tmp = (1.0 / y) / (hypot(1.0, z) * (hypot(1.0, z) * x));
}
return tmp;
}
public static double code(double x, double y, double z) {
double tmp;
if (x <= -4e+29) {
tmp = (-1.0 / (y * -x)) / (1.0 + (z * z));
} else {
tmp = (1.0 / y) / (Math.hypot(1.0, z) * (Math.hypot(1.0, z) * x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4e+29: tmp = (-1.0 / (y * -x)) / (1.0 + (z * z)) else: tmp = (1.0 / y) / (math.hypot(1.0, z) * (math.hypot(1.0, z) * x)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4e+29) tmp = Float64(Float64(-1.0 / Float64(y * Float64(-x))) / Float64(1.0 + Float64(z * z))); else tmp = Float64(Float64(1.0 / y) / Float64(hypot(1.0, z) * Float64(hypot(1.0, z) * x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -4e+29) tmp = (-1.0 / (y * -x)) / (1.0 + (z * z)); else tmp = (1.0 / y) / (hypot(1.0, z) * (hypot(1.0, z) * x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4e+29], N[(N[(-1.0 / N[(y * (-x)), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{+29}:\\
\;\;\;\;\frac{\frac{-1}{y \cdot \left(-x\right)}}{1 + z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y}}{\mathsf{hypot}\left(1, z\right) \cdot \left(\mathsf{hypot}\left(1, z\right) \cdot x\right)}\\
\end{array}
\end{array}
if x < -3.99999999999999966e29Initial program 99.7%
associate-/r*99.7%
Simplified99.7%
frac-2neg99.7%
div-inv99.7%
distribute-neg-frac99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-*r/99.7%
*-rgt-identity99.7%
metadata-eval99.7%
distribute-neg-frac99.7%
distribute-neg-frac99.7%
associate-/l/99.8%
distribute-lft-neg-out99.8%
distribute-neg-frac99.8%
metadata-eval99.8%
distribute-lft-neg-out99.8%
*-commutative99.8%
Simplified99.8%
if -3.99999999999999966e29 < x Initial program 89.0%
associate-/r*89.0%
+-commutative89.0%
fma-def89.0%
Simplified89.0%
fma-udef89.0%
+-commutative89.0%
associate-/r*89.0%
associate-/r*88.8%
add-sqr-sqrt88.8%
*-un-lft-identity88.8%
times-frac88.8%
hypot-1-def88.8%
associate-/l/88.8%
hypot-1-def91.9%
Applied egg-rr91.9%
associate-*l/92.0%
*-lft-identity92.0%
associate-/r*92.0%
associate-/l/96.9%
*-commutative96.9%
Simplified96.9%
expm1-log1p-u79.0%
expm1-udef45.1%
associate-/l/45.9%
Applied egg-rr45.9%
expm1-def76.5%
expm1-log1p95.9%
Simplified95.9%
Final simplification96.8%
(FPCore (x y z) :precision binary64 (if (<= (* z z) 4e+144) (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))) (/ (/ 1.0 (* y (* z x))) (hypot 1.0 z))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 4e+144) {
tmp = (1.0 / x) / (y * (1.0 + (z * z)));
} else {
tmp = (1.0 / (y * (z * x))) / hypot(1.0, z);
}
return tmp;
}
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 4e+144) {
tmp = (1.0 / x) / (y * (1.0 + (z * z)));
} else {
tmp = (1.0 / (y * (z * x))) / Math.hypot(1.0, z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 4e+144: tmp = (1.0 / x) / (y * (1.0 + (z * z))) else: tmp = (1.0 / (y * (z * x))) / math.hypot(1.0, z) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 4e+144) tmp = Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))); else tmp = Float64(Float64(1.0 / Float64(y * Float64(z * x))) / hypot(1.0, z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 4e+144) tmp = (1.0 / x) / (y * (1.0 + (z * z))); else tmp = (1.0 / (y * (z * x))) / hypot(1.0, z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 4e+144], N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{+144}:\\
\;\;\;\;\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y \cdot \left(z \cdot x\right)}}{\mathsf{hypot}\left(1, z\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 4.00000000000000009e144Initial program 98.5%
if 4.00000000000000009e144 < (*.f64 z z) Initial program 79.7%
associate-/r*79.7%
+-commutative79.7%
fma-def79.7%
Simplified79.7%
fma-udef79.7%
+-commutative79.7%
associate-/r*79.7%
associate-/r*81.2%
add-sqr-sqrt81.2%
*-un-lft-identity81.2%
times-frac81.3%
hypot-1-def81.3%
associate-/l/81.3%
hypot-1-def87.8%
Applied egg-rr87.8%
associate-*l/87.8%
*-lft-identity87.8%
associate-/r*87.8%
associate-/l/96.8%
*-commutative96.8%
Simplified96.8%
Taylor expanded in z around inf 83.4%
Final simplification92.8%
(FPCore (x y z) :precision binary64 (if (<= (* z z) 2e+179) (/ 1.0 (* x (+ y (* y (* z z))))) (* (/ 1.0 (* y (* z x))) (/ 1.0 z))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e+179) {
tmp = 1.0 / (x * (y + (y * (z * z))));
} else {
tmp = (1.0 / (y * (z * x))) * (1.0 / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 2d+179) then
tmp = 1.0d0 / (x * (y + (y * (z * z))))
else
tmp = (1.0d0 / (y * (z * x))) * (1.0d0 / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e+179) {
tmp = 1.0 / (x * (y + (y * (z * z))));
} else {
tmp = (1.0 / (y * (z * x))) * (1.0 / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 2e+179: tmp = 1.0 / (x * (y + (y * (z * z)))) else: tmp = (1.0 / (y * (z * x))) * (1.0 / z) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 2e+179) tmp = Float64(1.0 / Float64(x * Float64(y + Float64(y * Float64(z * z))))); else tmp = Float64(Float64(1.0 / Float64(y * Float64(z * x))) * Float64(1.0 / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 2e+179) tmp = 1.0 / (x * (y + (y * (z * z)))); else tmp = (1.0 / (y * (z * x))) * (1.0 / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+179], N[(1.0 / N[(x * N[(y + N[(y * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+179}:\\
\;\;\;\;\frac{1}{x \cdot \left(y + y \cdot \left(z \cdot z\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y \cdot \left(z \cdot x\right)} \cdot \frac{1}{z}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.99999999999999996e179Initial program 97.9%
associate-/r*97.9%
+-commutative97.9%
fma-def97.9%
Simplified97.9%
fma-udef97.9%
distribute-lft-in97.9%
*-rgt-identity97.9%
Applied egg-rr97.9%
if 1.99999999999999996e179 < (*.f64 z z) Initial program 79.7%
associate-/r*79.7%
+-commutative79.7%
fma-def79.7%
Simplified79.7%
Taylor expanded in z around inf 77.6%
unpow277.6%
*-commutative77.6%
associate-*l*81.3%
*-commutative81.3%
associate-*l*87.8%
Simplified87.8%
inv-pow87.8%
*-commutative87.8%
unpow-prod-down88.2%
*-commutative88.2%
associate-*r*96.7%
inv-pow96.7%
inv-pow96.7%
Applied egg-rr96.7%
Final simplification97.5%
(FPCore (x y z) :precision binary64 (if (<= (* z z) 1e+183) (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))) (* (/ 1.0 (* y (* z x))) (/ 1.0 z))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e+183) {
tmp = (1.0 / x) / (y * (1.0 + (z * z)));
} else {
tmp = (1.0 / (y * (z * x))) * (1.0 / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 1d+183) then
tmp = (1.0d0 / x) / (y * (1.0d0 + (z * z)))
else
tmp = (1.0d0 / (y * (z * x))) * (1.0d0 / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e+183) {
tmp = (1.0 / x) / (y * (1.0 + (z * z)));
} else {
tmp = (1.0 / (y * (z * x))) * (1.0 / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 1e+183: tmp = (1.0 / x) / (y * (1.0 + (z * z))) else: tmp = (1.0 / (y * (z * x))) * (1.0 / z) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 1e+183) tmp = Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))); else tmp = Float64(Float64(1.0 / Float64(y * Float64(z * x))) * Float64(1.0 / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 1e+183) tmp = (1.0 / x) / (y * (1.0 + (z * z))); else tmp = (1.0 / (y * (z * x))) * (1.0 / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+183], N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+183}:\\
\;\;\;\;\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y \cdot \left(z \cdot x\right)} \cdot \frac{1}{z}\\
\end{array}
\end{array}
if (*.f64 z z) < 9.99999999999999947e182Initial program 97.9%
if 9.99999999999999947e182 < (*.f64 z z) Initial program 79.2%
associate-/r*79.2%
+-commutative79.2%
fma-def79.2%
Simplified79.2%
Taylor expanded in z around inf 77.1%
unpow277.1%
*-commutative77.1%
associate-*l*80.9%
*-commutative80.9%
associate-*l*87.6%
Simplified87.6%
inv-pow87.6%
*-commutative87.6%
unpow-prod-down88.0%
*-commutative88.0%
associate-*r*96.6%
inv-pow96.6%
inv-pow96.6%
Applied egg-rr96.6%
Final simplification97.5%
(FPCore (x y z) :precision binary64 (if (<= (* z z) 0.1) (/ (/ 1.0 x) y) (/ 1.0 (* x (* z (* y z))))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 0.1) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / (x * (z * (y * z)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 0.1d0) then
tmp = (1.0d0 / x) / y
else
tmp = 1.0d0 / (x * (z * (y * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 0.1) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / (x * (z * (y * z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 0.1: tmp = (1.0 / x) / y else: tmp = 1.0 / (x * (z * (y * z))) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 0.1) tmp = Float64(Float64(1.0 / x) / y); else tmp = Float64(1.0 / Float64(x * Float64(z * Float64(y * z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 0.1) tmp = (1.0 / x) / y; else tmp = 1.0 / (x * (z * (y * z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 0.1], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision], N[(1.0 / N[(x * N[(z * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 0.1:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(z \cdot \left(y \cdot z\right)\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 0.10000000000000001Initial program 99.7%
associate-/r*99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in z around 0 98.8%
inv-pow98.8%
unpow-prod-down98.8%
inv-pow98.8%
inv-pow98.8%
Applied egg-rr98.8%
associate-*l/98.8%
*-un-lft-identity98.8%
Applied egg-rr98.8%
if 0.10000000000000001 < (*.f64 z z) Initial program 82.6%
associate-/r*82.7%
+-commutative82.7%
fma-def82.7%
Simplified82.7%
Taylor expanded in z around inf 81.3%
unpow281.3%
associate-*r*90.7%
*-commutative90.7%
Simplified90.7%
Final simplification94.9%
(FPCore (x y z) :precision binary64 (if (<= (* z z) 0.1) (/ (/ 1.0 x) y) (/ 1.0 (* y (* z (* z x))))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 0.1) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / (y * (z * (z * x)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 0.1d0) then
tmp = (1.0d0 / x) / y
else
tmp = 1.0d0 / (y * (z * (z * x)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 0.1) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / (y * (z * (z * x)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 0.1: tmp = (1.0 / x) / y else: tmp = 1.0 / (y * (z * (z * x))) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 0.1) tmp = Float64(Float64(1.0 / x) / y); else tmp = Float64(1.0 / Float64(y * Float64(z * Float64(z * x)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 0.1) tmp = (1.0 / x) / y; else tmp = 1.0 / (y * (z * (z * x))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 0.1], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision], N[(1.0 / N[(y * N[(z * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 0.1:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y \cdot \left(z \cdot \left(z \cdot x\right)\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 0.10000000000000001Initial program 99.7%
associate-/r*99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in z around 0 98.8%
inv-pow98.8%
unpow-prod-down98.8%
inv-pow98.8%
inv-pow98.8%
Applied egg-rr98.8%
associate-*l/98.8%
*-un-lft-identity98.8%
Applied egg-rr98.8%
if 0.10000000000000001 < (*.f64 z z) Initial program 82.6%
associate-/r*82.7%
+-commutative82.7%
fma-def82.7%
Simplified82.7%
Taylor expanded in z around inf 82.0%
unpow282.0%
*-commutative82.0%
associate-*l*81.7%
*-commutative81.7%
associate-*l*86.6%
Simplified86.6%
Taylor expanded in z around 0 82.0%
unpow282.0%
associate-*r*91.3%
Simplified91.3%
Final simplification95.2%
(FPCore (x y z) :precision binary64 (if (<= (* z z) 0.1) (/ (/ 1.0 x) y) (/ 1.0 (* z (* y (* z x))))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 0.1) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / (z * (y * (z * x)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 0.1d0) then
tmp = (1.0d0 / x) / y
else
tmp = 1.0d0 / (z * (y * (z * x)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 0.1) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / (z * (y * (z * x)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 0.1: tmp = (1.0 / x) / y else: tmp = 1.0 / (z * (y * (z * x))) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 0.1) tmp = Float64(Float64(1.0 / x) / y); else tmp = Float64(1.0 / Float64(z * Float64(y * Float64(z * x)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 0.1) tmp = (1.0 / x) / y; else tmp = 1.0 / (z * (y * (z * x))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 0.1], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision], N[(1.0 / N[(z * N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 0.1:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z \cdot \left(y \cdot \left(z \cdot x\right)\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 0.10000000000000001Initial program 99.7%
associate-/r*99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in z around 0 98.8%
inv-pow98.8%
unpow-prod-down98.8%
inv-pow98.8%
inv-pow98.8%
Applied egg-rr98.8%
associate-*l/98.8%
*-un-lft-identity98.8%
Applied egg-rr98.8%
if 0.10000000000000001 < (*.f64 z z) Initial program 82.6%
associate-/r*82.7%
+-commutative82.7%
fma-def82.7%
Simplified82.7%
Taylor expanded in z around inf 82.0%
unpow282.0%
*-commutative82.0%
associate-*l*81.7%
*-commutative81.7%
associate-*l*86.6%
Simplified86.6%
Taylor expanded in z around 0 94.8%
Final simplification96.9%
(FPCore (x y z) :precision binary64 (if (<= (* z z) 0.1) (/ (/ 1.0 x) y) (/ 1.0 (* z (* x (* y z))))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 0.1) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / (z * (x * (y * z)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 0.1d0) then
tmp = (1.0d0 / x) / y
else
tmp = 1.0d0 / (z * (x * (y * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 0.1) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / (z * (x * (y * z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 0.1: tmp = (1.0 / x) / y else: tmp = 1.0 / (z * (x * (y * z))) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 0.1) tmp = Float64(Float64(1.0 / x) / y); else tmp = Float64(1.0 / Float64(z * Float64(x * Float64(y * z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 0.1) tmp = (1.0 / x) / y; else tmp = 1.0 / (z * (x * (y * z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 0.1], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision], N[(1.0 / N[(z * N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 0.1:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z \cdot \left(x \cdot \left(y \cdot z\right)\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 0.10000000000000001Initial program 99.7%
associate-/r*99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
Taylor expanded in z around 0 98.8%
inv-pow98.8%
unpow-prod-down98.8%
inv-pow98.8%
inv-pow98.8%
Applied egg-rr98.8%
associate-*l/98.8%
*-un-lft-identity98.8%
Applied egg-rr98.8%
if 0.10000000000000001 < (*.f64 z z) Initial program 82.6%
associate-/r*82.7%
+-commutative82.7%
fma-def82.7%
Simplified82.7%
Taylor expanded in z around inf 82.0%
unpow282.0%
*-commutative82.0%
associate-*l*81.7%
*-commutative81.7%
associate-*l*86.6%
Simplified86.6%
Taylor expanded in z around 0 94.8%
expm1-log1p-u57.7%
expm1-udef37.6%
*-commutative37.6%
associate-*l*38.3%
*-commutative38.3%
Applied egg-rr38.3%
expm1-def49.5%
expm1-log1p86.6%
associate-*r*94.1%
*-commutative94.1%
Simplified94.1%
Final simplification96.5%
(FPCore (x y z) :precision binary64 (if (<= (* z z) 0.1) (/ (- 1.0 (* z z)) (* y x)) (/ 1.0 (* z (* x (* y z))))))
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 0.1) {
tmp = (1.0 - (z * z)) / (y * x);
} else {
tmp = 1.0 / (z * (x * (y * z)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z * z) <= 0.1d0) then
tmp = (1.0d0 - (z * z)) / (y * x)
else
tmp = 1.0d0 / (z * (x * (y * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 0.1) {
tmp = (1.0 - (z * z)) / (y * x);
} else {
tmp = 1.0 / (z * (x * (y * z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z * z) <= 0.1: tmp = (1.0 - (z * z)) / (y * x) else: tmp = 1.0 / (z * (x * (y * z))) return tmp
function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 0.1) tmp = Float64(Float64(1.0 - Float64(z * z)) / Float64(y * x)); else tmp = Float64(1.0 / Float64(z * Float64(x * Float64(y * z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z * z) <= 0.1) tmp = (1.0 - (z * z)) / (y * x); else tmp = 1.0 / (z * (x * (y * z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 0.1], N[(N[(1.0 - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * x), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(z * N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 0.1:\\
\;\;\;\;\frac{1 - z \cdot z}{y \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z \cdot \left(x \cdot \left(y \cdot z\right)\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 0.10000000000000001Initial program 99.7%
associate-/r*99.7%
+-commutative99.7%
fma-def99.7%
Simplified99.7%
fma-udef99.7%
+-commutative99.7%
associate-/r*99.7%
associate-/r*99.7%
add-sqr-sqrt99.7%
*-un-lft-identity99.7%
times-frac99.7%
hypot-1-def99.7%
associate-/l/99.7%
hypot-1-def99.7%
Applied egg-rr99.7%
associate-*l/99.7%
*-lft-identity99.7%
associate-/r*99.7%
associate-/l/99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*r*99.7%
+-commutative99.7%
unpow299.7%
Simplified99.7%
Taylor expanded in z around 0 88.6%
mul-1-neg88.6%
unsub-neg88.6%
unpow288.6%
div-sub99.1%
Simplified99.1%
if 0.10000000000000001 < (*.f64 z z) Initial program 82.6%
associate-/r*82.7%
+-commutative82.7%
fma-def82.7%
Simplified82.7%
Taylor expanded in z around inf 82.0%
unpow282.0%
*-commutative82.0%
associate-*l*81.7%
*-commutative81.7%
associate-*l*86.6%
Simplified86.6%
Taylor expanded in z around 0 94.8%
expm1-log1p-u57.7%
expm1-udef37.6%
*-commutative37.6%
associate-*l*38.3%
*-commutative38.3%
Applied egg-rr38.3%
expm1-def49.5%
expm1-log1p86.6%
associate-*r*94.1%
*-commutative94.1%
Simplified94.1%
Final simplification96.7%
(FPCore (x y z) :precision binary64 (/ 1.0 (* y x)))
double code(double x, double y, double z) {
return 1.0 / (y * x);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0 / (y * x)
end function
public static double code(double x, double y, double z) {
return 1.0 / (y * x);
}
def code(x, y, z): return 1.0 / (y * x)
function code(x, y, z) return Float64(1.0 / Float64(y * x)) end
function tmp = code(x, y, z) tmp = 1.0 / (y * x); end
code[x_, y_, z_] := N[(1.0 / N[(y * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{y \cdot x}
\end{array}
Initial program 91.4%
associate-/r*91.4%
+-commutative91.4%
fma-def91.4%
Simplified91.4%
Taylor expanded in z around 0 58.1%
Final simplification58.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 1.0 (* z z))) (t_1 (* y t_0)) (t_2 (/ (/ 1.0 y) (* t_0 x))))
(if (< t_1 (- INFINITY))
t_2
(if (< t_1 8.680743250567252e+305) (/ (/ 1.0 x) (* t_0 y)) t_2))))
double code(double x, double y, double z) {
double t_0 = 1.0 + (z * z);
double t_1 = y * t_0;
double t_2 = (1.0 / y) / (t_0 * x);
double tmp;
if (t_1 < -((double) INFINITY)) {
tmp = t_2;
} else if (t_1 < 8.680743250567252e+305) {
tmp = (1.0 / x) / (t_0 * y);
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = 1.0 + (z * z);
double t_1 = y * t_0;
double t_2 = (1.0 / y) / (t_0 * x);
double tmp;
if (t_1 < -Double.POSITIVE_INFINITY) {
tmp = t_2;
} else if (t_1 < 8.680743250567252e+305) {
tmp = (1.0 / x) / (t_0 * y);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 + (z * z) t_1 = y * t_0 t_2 = (1.0 / y) / (t_0 * x) tmp = 0 if t_1 < -math.inf: tmp = t_2 elif t_1 < 8.680743250567252e+305: tmp = (1.0 / x) / (t_0 * y) else: tmp = t_2 return tmp
function code(x, y, z) t_0 = Float64(1.0 + Float64(z * z)) t_1 = Float64(y * t_0) t_2 = Float64(Float64(1.0 / y) / Float64(t_0 * x)) tmp = 0.0 if (t_1 < Float64(-Inf)) tmp = t_2; elseif (t_1 < 8.680743250567252e+305) tmp = Float64(Float64(1.0 / x) / Float64(t_0 * y)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 + (z * z); t_1 = y * t_0; t_2 = (1.0 / y) / (t_0 * x); tmp = 0.0; if (t_1 < -Inf) tmp = t_2; elseif (t_1 < 8.680743250567252e+305) tmp = (1.0 / x) / (t_0 * y); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(1.0 / y), $MachinePrecision] / N[(t$95$0 * x), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$1, (-Infinity)], t$95$2, If[Less[t$95$1, 8.680743250567252e+305], N[(N[(1.0 / x), $MachinePrecision] / N[(t$95$0 * y), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + z \cdot z\\
t_1 := y \cdot t_0\\
t_2 := \frac{\frac{1}{y}}{t_0 \cdot x}\\
\mathbf{if}\;t_1 < -\infty:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 < 8.680743250567252 \cdot 10^{+305}:\\
\;\;\;\;\frac{\frac{1}{x}}{t_0 \cdot y}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
herbie shell --seed 2023199
(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)))))