
(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 12 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}
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (+ 1.0 (* z z)))))
(if (<= t_0 (- INFINITY))
(/ 1.0 (* x (* z (* y z))))
(if (<= t_0 1e+308)
(/ (/ 1.0 x) t_0)
(* (/ (/ 1.0 y) (* x z)) (/ 1.0 z))))))assert(x < y);
double code(double x, double y, double z) {
double t_0 = y * (1.0 + (z * z));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = 1.0 / (x * (z * (y * z)));
} else if (t_0 <= 1e+308) {
tmp = (1.0 / x) / t_0;
} else {
tmp = ((1.0 / y) / (x * z)) * (1.0 / z);
}
return tmp;
}
assert x < y;
public static double code(double x, double y, double z) {
double t_0 = y * (1.0 + (z * z));
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = 1.0 / (x * (z * (y * z)));
} else if (t_0 <= 1e+308) {
tmp = (1.0 / x) / t_0;
} else {
tmp = ((1.0 / y) / (x * z)) * (1.0 / z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): t_0 = y * (1.0 + (z * z)) tmp = 0 if t_0 <= -math.inf: tmp = 1.0 / (x * (z * (y * z))) elif t_0 <= 1e+308: tmp = (1.0 / x) / t_0 else: tmp = ((1.0 / y) / (x * z)) * (1.0 / z) return tmp
x, y = sort([x, y]) function code(x, y, z) t_0 = Float64(y * Float64(1.0 + Float64(z * z))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(1.0 / Float64(x * Float64(z * Float64(y * z)))); elseif (t_0 <= 1e+308) tmp = Float64(Float64(1.0 / x) / t_0); else tmp = Float64(Float64(Float64(1.0 / y) / Float64(x * z)) * Float64(1.0 / z)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
t_0 = y * (1.0 + (z * z));
tmp = 0.0;
if (t_0 <= -Inf)
tmp = 1.0 / (x * (z * (y * z)));
elseif (t_0 <= 1e+308)
tmp = (1.0 / x) / t_0;
else
tmp = ((1.0 / y) / (x * z)) * (1.0 / z);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(1.0 / N[(x * N[(z * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+308], N[(N[(1.0 / x), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[(1.0 / y), $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y \cdot \left(1 + z \cdot z\right)\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;\frac{1}{x \cdot \left(z \cdot \left(y \cdot z\right)\right)}\\
\mathbf{elif}\;t_0 \leq 10^{+308}:\\
\;\;\;\;\frac{\frac{1}{x}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y}}{x \cdot z} \cdot \frac{1}{z}\\
\end{array}
\end{array}
if (*.f64 y (+.f64 1 (*.f64 z z))) < -inf.0Initial program 73.0%
associate-/r*73.0%
+-commutative73.0%
fma-def73.0%
Simplified73.0%
Taylor expanded in z around inf 73.0%
unpow273.0%
associate-*r*86.9%
*-commutative86.9%
Simplified86.9%
if -inf.0 < (*.f64 y (+.f64 1 (*.f64 z z))) < 1e308Initial program 99.6%
if 1e308 < (*.f64 y (+.f64 1 (*.f64 z z))) Initial program 67.5%
associate-/r*67.5%
+-commutative67.5%
fma-def67.5%
Simplified67.5%
fma-udef67.5%
+-commutative67.5%
associate-/r*67.5%
associate-/r*75.0%
add-sqr-sqrt75.0%
*-un-lft-identity75.0%
times-frac75.0%
hypot-1-def75.0%
associate-/l/75.0%
hypot-1-def90.5%
Applied egg-rr90.5%
associate-*l/90.4%
*-lft-identity90.4%
associate-/r*90.4%
associate-/l/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 73.6%
unpow273.6%
Simplified73.6%
associate-/r*75.3%
*-un-lft-identity75.3%
associate-*l*93.8%
times-frac99.8%
Applied egg-rr99.8%
Final simplification97.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (/ (/ (/ 1.0 y) (* x (hypot 1.0 z))) (hypot 1.0 z)))
assert(x < y);
double code(double x, double y, double z) {
return ((1.0 / y) / (x * hypot(1.0, z))) / hypot(1.0, z);
}
assert x < y;
public static double code(double x, double y, double z) {
return ((1.0 / y) / (x * Math.hypot(1.0, z))) / Math.hypot(1.0, z);
}
[x, y] = sort([x, y]) def code(x, y, z): return ((1.0 / y) / (x * math.hypot(1.0, z))) / math.hypot(1.0, z)
x, y = sort([x, y]) function code(x, y, z) return Float64(Float64(Float64(1.0 / y) / Float64(x * hypot(1.0, z))) / hypot(1.0, z)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = ((1.0 / y) / (x * hypot(1.0, z))) / hypot(1.0, z);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(N[(N[(1.0 / y), $MachinePrecision] / N[(x * N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{\frac{1}{y}}{x \cdot \mathsf{hypot}\left(1, z\right)}}{\mathsf{hypot}\left(1, z\right)}
\end{array}
Initial program 91.4%
associate-/r*90.8%
+-commutative90.8%
fma-def90.8%
Simplified90.8%
fma-udef90.8%
+-commutative90.8%
associate-/r*91.4%
associate-/r*90.7%
add-sqr-sqrt90.7%
*-un-lft-identity90.7%
times-frac90.7%
hypot-1-def90.7%
associate-/l/90.1%
hypot-1-def94.2%
Applied egg-rr94.2%
associate-*l/94.2%
*-lft-identity94.2%
associate-/r*94.8%
associate-/l/97.5%
*-commutative97.5%
Simplified97.5%
Final simplification97.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* z z) 5e+205) (/ (/ (/ 1.0 x) y) (+ 1.0 (* z z))) (/ (/ (/ 1.0 y) (* x z)) (hypot 1.0 z))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 5e+205) {
tmp = ((1.0 / x) / y) / (1.0 + (z * z));
} else {
tmp = ((1.0 / y) / (x * z)) / hypot(1.0, z);
}
return tmp;
}
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 5e+205) {
tmp = ((1.0 / x) / y) / (1.0 + (z * z));
} else {
tmp = ((1.0 / y) / (x * z)) / Math.hypot(1.0, z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 5e+205: tmp = ((1.0 / x) / y) / (1.0 + (z * z)) else: tmp = ((1.0 / y) / (x * z)) / math.hypot(1.0, z) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 5e+205) tmp = Float64(Float64(Float64(1.0 / x) / y) / Float64(1.0 + Float64(z * z))); else tmp = Float64(Float64(Float64(1.0 / y) / Float64(x * z)) / hypot(1.0, z)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z * z) <= 5e+205)
tmp = ((1.0 / x) / y) / (1.0 + (z * z));
else
tmp = ((1.0 / y) / (x * z)) / hypot(1.0, z);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+205], N[(N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision] / N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / y), $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+205}:\\
\;\;\;\;\frac{\frac{\frac{1}{x}}{y}}{1 + z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{y}}{x \cdot z}}{\mathsf{hypot}\left(1, z\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 5.0000000000000002e205Initial program 98.1%
associate-/r*99.1%
Simplified99.1%
if 5.0000000000000002e205 < (*.f64 z z) Initial program 75.7%
associate-/r*75.6%
+-commutative75.6%
fma-def75.6%
Simplified75.6%
fma-udef75.6%
+-commutative75.6%
associate-/r*75.7%
associate-/r*70.8%
add-sqr-sqrt70.8%
*-un-lft-identity70.8%
times-frac70.8%
hypot-1-def70.8%
associate-/l/70.8%
hypot-1-def84.7%
Applied egg-rr84.7%
associate-*l/84.6%
*-lft-identity84.6%
associate-/r*84.6%
associate-/l/94.9%
*-commutative94.9%
Simplified94.9%
Taylor expanded in z around inf 85.0%
Final simplification94.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* z z) 1e-5) (/ (/ 1.0 y) x) (* (/ 1.0 z) (/ 1.0 (* x (* y z))))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e-5) {
tmp = (1.0 / y) / x;
} else {
tmp = (1.0 / z) * (1.0 / (x * (y * z)));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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-5) then
tmp = (1.0d0 / y) / x
else
tmp = (1.0d0 / z) * (1.0d0 / (x * (y * z)))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e-5) {
tmp = (1.0 / y) / x;
} else {
tmp = (1.0 / z) * (1.0 / (x * (y * z)));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 1e-5: tmp = (1.0 / y) / x else: tmp = (1.0 / z) * (1.0 / (x * (y * z))) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 1e-5) tmp = Float64(Float64(1.0 / y) / x); else tmp = Float64(Float64(1.0 / z) * Float64(1.0 / Float64(x * Float64(y * z)))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z * z) <= 1e-5)
tmp = (1.0 / y) / x;
else
tmp = (1.0 / z) * (1.0 / (x * (y * z)));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e-5], N[(N[(1.0 / y), $MachinePrecision] / x), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(1.0 / N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-5}:\\
\;\;\;\;\frac{\frac{1}{y}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{1}{x \cdot \left(y \cdot z\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.00000000000000008e-5Initial program 99.7%
associate-/r*98.6%
+-commutative98.6%
fma-def98.6%
Simplified98.6%
Taylor expanded in z around 0 97.4%
metadata-eval97.4%
frac-times98.4%
Applied egg-rr98.4%
un-div-inv98.5%
Applied egg-rr98.5%
if 1.00000000000000008e-5 < (*.f64 z z) Initial program 81.2%
associate-/r*81.1%
+-commutative81.1%
fma-def81.1%
Simplified81.1%
Taylor expanded in z around inf 76.7%
unpow276.7%
*-commutative76.7%
associate-*l*77.2%
*-commutative77.2%
associate-*l*87.4%
Simplified87.4%
associate-/r*88.6%
div-inv88.5%
associate-*r*92.3%
*-commutative92.3%
Applied egg-rr92.3%
Final simplification95.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* z z) 1e-5) (/ (/ 1.0 y) x) (* (/ (/ 1.0 y) (* x z)) (/ 1.0 z))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e-5) {
tmp = (1.0 / y) / x;
} else {
tmp = ((1.0 / y) / (x * z)) * (1.0 / z);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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-5) then
tmp = (1.0d0 / y) / x
else
tmp = ((1.0d0 / y) / (x * z)) * (1.0d0 / z)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e-5) {
tmp = (1.0 / y) / x;
} else {
tmp = ((1.0 / y) / (x * z)) * (1.0 / z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 1e-5: tmp = (1.0 / y) / x else: tmp = ((1.0 / y) / (x * z)) * (1.0 / z) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 1e-5) tmp = Float64(Float64(1.0 / y) / x); else tmp = Float64(Float64(Float64(1.0 / y) / Float64(x * z)) * Float64(1.0 / z)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z * z) <= 1e-5)
tmp = (1.0 / y) / x;
else
tmp = ((1.0 / y) / (x * z)) * (1.0 / z);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e-5], N[(N[(1.0 / y), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(1.0 / y), $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-5}:\\
\;\;\;\;\frac{\frac{1}{y}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y}}{x \cdot z} \cdot \frac{1}{z}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.00000000000000008e-5Initial program 99.7%
associate-/r*98.6%
+-commutative98.6%
fma-def98.6%
Simplified98.6%
Taylor expanded in z around 0 97.4%
metadata-eval97.4%
frac-times98.4%
Applied egg-rr98.4%
un-div-inv98.5%
Applied egg-rr98.5%
if 1.00000000000000008e-5 < (*.f64 z z) Initial program 81.2%
associate-/r*81.1%
+-commutative81.1%
fma-def81.1%
Simplified81.1%
fma-udef81.1%
+-commutative81.1%
associate-/r*81.2%
associate-/r*79.5%
add-sqr-sqrt79.5%
*-un-lft-identity79.5%
times-frac79.5%
hypot-1-def79.5%
associate-/l/79.5%
hypot-1-def88.7%
Applied egg-rr88.7%
associate-*l/88.7%
*-lft-identity88.7%
associate-/r*88.7%
associate-/l/94.7%
*-commutative94.7%
Simplified94.7%
Taylor expanded in z around inf 76.7%
unpow276.7%
Simplified76.7%
associate-/r*77.7%
*-un-lft-identity77.7%
associate-*l*88.5%
times-frac93.6%
Applied egg-rr93.6%
Final simplification96.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* z z) 5e+205) (/ (/ (/ 1.0 x) y) (+ 1.0 (* z z))) (* (/ (/ 1.0 y) (* x z)) (/ 1.0 z))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 5e+205) {
tmp = ((1.0 / x) / y) / (1.0 + (z * z));
} else {
tmp = ((1.0 / y) / (x * z)) * (1.0 / z);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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) <= 5d+205) then
tmp = ((1.0d0 / x) / y) / (1.0d0 + (z * z))
else
tmp = ((1.0d0 / y) / (x * z)) * (1.0d0 / z)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 5e+205) {
tmp = ((1.0 / x) / y) / (1.0 + (z * z));
} else {
tmp = ((1.0 / y) / (x * z)) * (1.0 / z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 5e+205: tmp = ((1.0 / x) / y) / (1.0 + (z * z)) else: tmp = ((1.0 / y) / (x * z)) * (1.0 / z) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 5e+205) tmp = Float64(Float64(Float64(1.0 / x) / y) / Float64(1.0 + Float64(z * z))); else tmp = Float64(Float64(Float64(1.0 / y) / Float64(x * z)) * Float64(1.0 / z)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z * z) <= 5e+205)
tmp = ((1.0 / x) / y) / (1.0 + (z * z));
else
tmp = ((1.0 / y) / (x * z)) * (1.0 / z);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+205], N[(N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision] / N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / y), $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+205}:\\
\;\;\;\;\frac{\frac{\frac{1}{x}}{y}}{1 + z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y}}{x \cdot z} \cdot \frac{1}{z}\\
\end{array}
\end{array}
if (*.f64 z z) < 5.0000000000000002e205Initial program 98.1%
associate-/r*99.1%
Simplified99.1%
if 5.0000000000000002e205 < (*.f64 z z) Initial program 75.7%
associate-/r*75.6%
+-commutative75.6%
fma-def75.6%
Simplified75.6%
fma-udef75.6%
+-commutative75.6%
associate-/r*75.7%
associate-/r*70.8%
add-sqr-sqrt70.8%
*-un-lft-identity70.8%
times-frac70.8%
hypot-1-def70.8%
associate-/l/70.8%
hypot-1-def84.7%
Applied egg-rr84.7%
associate-*l/84.6%
*-lft-identity84.6%
associate-/r*84.6%
associate-/l/94.9%
*-commutative94.9%
Simplified94.9%
Taylor expanded in z around inf 74.3%
unpow274.3%
Simplified74.3%
associate-/r*75.9%
*-un-lft-identity75.9%
associate-*l*92.1%
times-frac94.8%
Applied egg-rr94.8%
Final simplification97.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* z z) 1e-5) (/ (/ 1.0 y) x) (/ 1.0 (* y (* z (* x z))))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e-5) {
tmp = (1.0 / y) / x;
} else {
tmp = 1.0 / (y * (z * (x * z)));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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-5) then
tmp = (1.0d0 / y) / x
else
tmp = 1.0d0 / (y * (z * (x * z)))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e-5) {
tmp = (1.0 / y) / x;
} else {
tmp = 1.0 / (y * (z * (x * z)));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 1e-5: tmp = (1.0 / y) / x else: tmp = 1.0 / (y * (z * (x * z))) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 1e-5) tmp = Float64(Float64(1.0 / y) / x); else tmp = Float64(1.0 / Float64(y * Float64(z * Float64(x * z)))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z * z) <= 1e-5)
tmp = (1.0 / y) / x;
else
tmp = 1.0 / (y * (z * (x * z)));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e-5], N[(N[(1.0 / y), $MachinePrecision] / x), $MachinePrecision], N[(1.0 / N[(y * N[(z * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-5}:\\
\;\;\;\;\frac{\frac{1}{y}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y \cdot \left(z \cdot \left(x \cdot z\right)\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.00000000000000008e-5Initial program 99.7%
associate-/r*98.6%
+-commutative98.6%
fma-def98.6%
Simplified98.6%
Taylor expanded in z around 0 97.4%
metadata-eval97.4%
frac-times98.4%
Applied egg-rr98.4%
un-div-inv98.5%
Applied egg-rr98.5%
if 1.00000000000000008e-5 < (*.f64 z z) Initial program 81.2%
associate-/r*81.1%
+-commutative81.1%
fma-def81.1%
Simplified81.1%
fma-udef81.1%
+-commutative81.1%
associate-/r*81.2%
associate-/r*79.5%
add-sqr-sqrt79.5%
*-un-lft-identity79.5%
times-frac79.5%
hypot-1-def79.5%
associate-/l/79.5%
hypot-1-def88.7%
Applied egg-rr88.7%
associate-*l/88.7%
*-lft-identity88.7%
associate-/r*88.7%
associate-/l/94.7%
*-commutative94.7%
Simplified94.7%
associate-/l/89.7%
div-inv89.7%
Applied egg-rr89.7%
Taylor expanded in z around inf 76.7%
unpow276.7%
associate-*r*87.5%
Simplified87.5%
Final simplification93.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* z z) 1e-5) (/ (/ 1.0 y) x) (/ 1.0 (* z (* x (* y z))))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e-5) {
tmp = (1.0 / y) / x;
} else {
tmp = 1.0 / (z * (x * (y * z)));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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-5) then
tmp = (1.0d0 / y) / x
else
tmp = 1.0d0 / (z * (x * (y * z)))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 1e-5) {
tmp = (1.0 / y) / x;
} else {
tmp = 1.0 / (z * (x * (y * z)));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 1e-5: tmp = (1.0 / y) / x else: tmp = 1.0 / (z * (x * (y * z))) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 1e-5) tmp = Float64(Float64(1.0 / y) / x); else tmp = Float64(1.0 / Float64(z * Float64(x * Float64(y * z)))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z * z) <= 1e-5)
tmp = (1.0 / y) / x;
else
tmp = 1.0 / (z * (x * (y * z)));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e-5], N[(N[(1.0 / y), $MachinePrecision] / x), $MachinePrecision], N[(1.0 / N[(z * N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-5}:\\
\;\;\;\;\frac{\frac{1}{y}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z \cdot \left(x \cdot \left(y \cdot z\right)\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.00000000000000008e-5Initial program 99.7%
associate-/r*98.6%
+-commutative98.6%
fma-def98.6%
Simplified98.6%
Taylor expanded in z around 0 97.4%
metadata-eval97.4%
frac-times98.4%
Applied egg-rr98.4%
un-div-inv98.5%
Applied egg-rr98.5%
if 1.00000000000000008e-5 < (*.f64 z z) Initial program 81.2%
associate-/r*81.1%
+-commutative81.1%
fma-def81.1%
Simplified81.1%
Taylor expanded in z around inf 76.7%
unpow276.7%
*-commutative76.7%
associate-*l*77.2%
*-commutative77.2%
associate-*l*87.4%
Simplified87.4%
Taylor expanded in z around 0 92.4%
associate-*r*91.6%
*-commutative91.6%
*-commutative91.6%
Simplified91.6%
Final simplification95.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= z 1.0) (/ (/ 1.0 y) x) (/ 1.0 (* x (* z (* y z))))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y) / x;
} else {
tmp = 1.0 / (x * (z * (y * z)));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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 <= 1.0d0) then
tmp = (1.0d0 / y) / x
else
tmp = 1.0d0 / (x * (z * (y * z)))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / y) / x;
} else {
tmp = 1.0 / (x * (z * (y * z)));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if z <= 1.0: tmp = (1.0 / y) / x else: tmp = 1.0 / (x * (z * (y * z))) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (z <= 1.0) tmp = Float64(Float64(1.0 / y) / x); else tmp = Float64(1.0 / Float64(x * Float64(z * Float64(y * z)))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (z <= 1.0)
tmp = (1.0 / y) / x;
else
tmp = 1.0 / (x * (z * (y * z)));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[z, 1.0], N[(N[(1.0 / y), $MachinePrecision] / x), $MachinePrecision], N[(1.0 / N[(x * N[(z * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{y}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(z \cdot \left(y \cdot z\right)\right)}\\
\end{array}
\end{array}
if z < 1Initial program 96.9%
associate-/r*96.2%
+-commutative96.2%
fma-def96.2%
Simplified96.2%
Taylor expanded in z around 0 76.9%
metadata-eval76.9%
frac-times77.2%
Applied egg-rr77.2%
un-div-inv77.3%
Applied egg-rr77.3%
if 1 < z Initial program 74.3%
associate-/r*74.1%
+-commutative74.1%
fma-def74.1%
Simplified74.1%
Taylor expanded in z around inf 72.9%
unpow272.9%
associate-*r*83.8%
*-commutative83.8%
Simplified83.8%
Final simplification78.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (/ 1.0 (* y x)))
assert(x < y);
double code(double x, double y, double z) {
return 1.0 / (y * x);
}
NOTE: x and y should be sorted in increasing order before calling this function.
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
assert x < y;
public static double code(double x, double y, double z) {
return 1.0 / (y * x);
}
[x, y] = sort([x, y]) def code(x, y, z): return 1.0 / (y * x)
x, y = sort([x, y]) function code(x, y, z) return Float64(1.0 / Float64(y * x)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = 1.0 / (y * x);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(1.0 / N[(y * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{y \cdot x}
\end{array}
Initial program 91.4%
associate-/r*90.8%
+-commutative90.8%
fma-def90.8%
Simplified90.8%
Taylor expanded in z around 0 62.2%
Final simplification62.2%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (/ (/ 1.0 x) y))
assert(x < y);
double code(double x, double y, double z) {
return (1.0 / x) / y;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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
end function
assert x < y;
public static double code(double x, double y, double z) {
return (1.0 / x) / y;
}
[x, y] = sort([x, y]) def code(x, y, z): return (1.0 / x) / y
x, y = sort([x, y]) function code(x, y, z) return Float64(Float64(1.0 / x) / y) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = (1.0 / x) / y;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{1}{x}}{y}
\end{array}
Initial program 91.4%
associate-/r*90.8%
+-commutative90.8%
fma-def90.8%
Simplified90.8%
fma-udef90.8%
+-commutative90.8%
associate-/r*91.4%
associate-/r*90.7%
add-sqr-sqrt90.7%
*-un-lft-identity90.7%
times-frac90.7%
hypot-1-def90.7%
associate-/l/90.1%
hypot-1-def94.2%
Applied egg-rr94.2%
associate-*l/94.2%
*-lft-identity94.2%
associate-/r*94.8%
associate-/l/97.5%
*-commutative97.5%
Simplified97.5%
associate-/l/95.2%
div-inv95.2%
Applied egg-rr95.2%
Taylor expanded in z around 0 62.2%
*-commutative62.2%
associate-/r*62.4%
Simplified62.4%
Final simplification62.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (/ (/ 1.0 y) x))
assert(x < y);
double code(double x, double y, double z) {
return (1.0 / y) / x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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
assert x < y;
public static double code(double x, double y, double z) {
return (1.0 / y) / x;
}
[x, y] = sort([x, y]) def code(x, y, z): return (1.0 / y) / x
x, y = sort([x, y]) function code(x, y, z) return Float64(Float64(1.0 / y) / x) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = (1.0 / y) / x;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(N[(1.0 / y), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{1}{y}}{x}
\end{array}
Initial program 91.4%
associate-/r*90.8%
+-commutative90.8%
fma-def90.8%
Simplified90.8%
Taylor expanded in z around 0 62.2%
metadata-eval62.2%
frac-times62.4%
Applied egg-rr62.4%
un-div-inv62.4%
Applied egg-rr62.4%
Final simplification62.4%
(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 2023221
(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)))))