
(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}
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (hypot 1.0 z))))
(if (<= x -2.4e-114)
(/ (/ (/ 1.0 y) t_0) (hypot 1.0 z))
(/ (/ 1.0 y) (* (hypot 1.0 z) t_0)))))assert(x < y);
double code(double x, double y, double z) {
double t_0 = x * hypot(1.0, z);
double tmp;
if (x <= -2.4e-114) {
tmp = ((1.0 / y) / t_0) / hypot(1.0, z);
} else {
tmp = (1.0 / y) / (hypot(1.0, z) * t_0);
}
return tmp;
}
assert x < y;
public static double code(double x, double y, double z) {
double t_0 = x * Math.hypot(1.0, z);
double tmp;
if (x <= -2.4e-114) {
tmp = ((1.0 / y) / t_0) / Math.hypot(1.0, z);
} else {
tmp = (1.0 / y) / (Math.hypot(1.0, z) * t_0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): t_0 = x * math.hypot(1.0, z) tmp = 0 if x <= -2.4e-114: tmp = ((1.0 / y) / t_0) / math.hypot(1.0, z) else: tmp = (1.0 / y) / (math.hypot(1.0, z) * t_0) return tmp
x, y = sort([x, y]) function code(x, y, z) t_0 = Float64(x * hypot(1.0, z)) tmp = 0.0 if (x <= -2.4e-114) tmp = Float64(Float64(Float64(1.0 / y) / t_0) / hypot(1.0, z)); else tmp = Float64(Float64(1.0 / y) / Float64(hypot(1.0, z) * t_0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
t_0 = x * hypot(1.0, z);
tmp = 0.0;
if (x <= -2.4e-114)
tmp = ((1.0 / y) / t_0) / hypot(1.0, z);
else
tmp = (1.0 / y) / (hypot(1.0, z) * t_0);
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[(x * N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.4e-114], N[(N[(N[(1.0 / y), $MachinePrecision] / t$95$0), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := x \cdot \mathsf{hypot}\left(1, z\right)\\
\mathbf{if}\;x \leq -2.4 \cdot 10^{-114}:\\
\;\;\;\;\frac{\frac{\frac{1}{y}}{t_0}}{\mathsf{hypot}\left(1, z\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y}}{\mathsf{hypot}\left(1, z\right) \cdot t_0}\\
\end{array}
\end{array}
if x < -2.4000000000000001e-114Initial program 94.0%
associate-/r*93.5%
+-commutative93.5%
fma-def93.5%
Simplified93.5%
fma-udef93.5%
+-commutative93.5%
associate-/r*94.0%
associate-/r*93.9%
add-sqr-sqrt93.9%
*-un-lft-identity93.9%
times-frac93.8%
hypot-1-def93.8%
associate-/l/93.3%
hypot-1-def96.8%
Applied egg-rr96.8%
associate-*l/96.9%
*-lft-identity96.9%
associate-/r*97.4%
associate-/l/97.6%
*-commutative97.6%
Simplified97.6%
if -2.4000000000000001e-114 < x Initial program 88.0%
associate-/r*87.5%
+-commutative87.5%
fma-def87.5%
Simplified87.5%
fma-udef87.5%
+-commutative87.5%
associate-/r*88.0%
associate-/r*88.2%
div-inv88.2%
add-sqr-sqrt88.1%
times-frac89.6%
hypot-1-def89.6%
hypot-1-def98.2%
Applied egg-rr98.2%
clear-num98.2%
frac-times96.0%
*-un-lft-identity96.0%
div-inv95.9%
remove-double-div96.0%
*-commutative96.0%
Applied egg-rr96.0%
Final simplification96.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (* (/ (/ 1.0 x) (hypot 1.0 z)) (/ (/ 1.0 y) (hypot 1.0 z))))
assert(x < y);
double code(double x, double y, double z) {
return ((1.0 / x) / hypot(1.0, z)) * ((1.0 / y) / hypot(1.0, z));
}
assert x < y;
public static double code(double x, double y, double z) {
return ((1.0 / x) / Math.hypot(1.0, z)) * ((1.0 / y) / Math.hypot(1.0, z));
}
[x, y] = sort([x, y]) def code(x, y, z): return ((1.0 / x) / math.hypot(1.0, z)) * ((1.0 / y) / math.hypot(1.0, z))
x, y = sort([x, y]) function code(x, y, z) return Float64(Float64(Float64(1.0 / x) / hypot(1.0, z)) * Float64(Float64(1.0 / y) / hypot(1.0, z))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = ((1.0 / x) / hypot(1.0, z)) * ((1.0 / y) / 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 / x), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / y), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + z ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{1}{x}}{\mathsf{hypot}\left(1, z\right)} \cdot \frac{\frac{1}{y}}{\mathsf{hypot}\left(1, z\right)}
\end{array}
Initial program 89.8%
associate-/r*89.3%
+-commutative89.3%
fma-def89.3%
Simplified89.3%
fma-udef89.3%
+-commutative89.3%
associate-/r*89.8%
associate-/r*89.9%
div-inv89.9%
add-sqr-sqrt89.9%
times-frac90.9%
hypot-1-def90.9%
hypot-1-def98.0%
Applied egg-rr98.0%
Final simplification98.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* z z) 2e+81) (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))) (/ (/ (/ 1.0 z) x) (* z y))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e+81) {
tmp = (1.0 / x) / (y * (1.0 + (z * z)));
} else {
tmp = ((1.0 / z) / x) / (z * y);
}
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) <= 2d+81) then
tmp = (1.0d0 / x) / (y * (1.0d0 + (z * z)))
else
tmp = ((1.0d0 / z) / x) / (z * y)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e+81) {
tmp = (1.0 / x) / (y * (1.0 + (z * z)));
} else {
tmp = ((1.0 / z) / x) / (z * y);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 2e+81: tmp = (1.0 / x) / (y * (1.0 + (z * z))) else: tmp = ((1.0 / z) / x) / (z * y) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 2e+81) tmp = Float64(Float64(1.0 / x) / Float64(y * Float64(1.0 + Float64(z * z)))); else tmp = Float64(Float64(Float64(1.0 / z) / x) / Float64(z * y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z * z) <= 2e+81)
tmp = (1.0 / x) / (y * (1.0 + (z * z)));
else
tmp = ((1.0 / z) / x) / (z * y);
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], 2e+81], N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z), $MachinePrecision] / x), $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+81}:\\
\;\;\;\;\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{z}}{x}}{z \cdot y}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.99999999999999984e81Initial program 99.7%
if 1.99999999999999984e81 < (*.f64 z z) Initial program 78.7%
associate-/r*78.7%
+-commutative78.7%
fma-def78.7%
Simplified78.7%
Taylor expanded in z around inf 77.9%
unpow277.9%
*-commutative77.9%
associate-*l*78.4%
*-commutative78.4%
associate-*l*86.4%
Simplified86.4%
expm1-log1p-u82.8%
expm1-udef61.6%
associate-/r*61.6%
associate-*r*63.9%
*-commutative63.9%
Applied egg-rr63.9%
expm1-def88.3%
expm1-log1p93.5%
associate-/r*96.2%
*-commutative96.2%
Simplified96.2%
Final simplification98.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (/ 1.0 (* x (* z (* z y)))) (/ (/ 1.0 x) y)))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = 1.0 / (x * (z * (z * y)));
} else {
tmp = (1.0 / x) / y;
}
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)) .or. (.not. (z <= 1.0d0))) then
tmp = 1.0d0 / (x * (z * (z * y)))
else
tmp = (1.0d0 / x) / y
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) || !(z <= 1.0)) {
tmp = 1.0 / (x * (z * (z * y)));
} else {
tmp = (1.0 / x) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = 1.0 / (x * (z * (z * y))) else: tmp = (1.0 / x) / y return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(1.0 / Float64(x * Float64(z * Float64(z * y)))); else tmp = Float64(Float64(1.0 / x) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z <= -1.0) || ~((z <= 1.0)))
tmp = 1.0 / (x * (z * (z * y)));
else
tmp = (1.0 / x) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(1.0 / N[(x * N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{1}{x \cdot \left(z \cdot \left(z \cdot y\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 80.6%
associate-/r*80.5%
+-commutative80.5%
fma-def80.5%
Simplified80.5%
Taylor expanded in z around inf 80.4%
unpow280.4%
associate-*r*89.7%
*-commutative89.7%
Simplified89.7%
if -1 < z < 1Initial program 99.7%
associate-/r*98.6%
+-commutative98.6%
fma-def98.6%
Simplified98.6%
Taylor expanded in z around 0 98.3%
metadata-eval98.3%
frac-times99.3%
Applied egg-rr99.3%
associate-*l/99.4%
*-un-lft-identity99.4%
Applied egg-rr99.4%
Final simplification94.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (/ 1.0 (* y (* z (* x z)))) (/ (/ 1.0 x) y)))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = 1.0 / (y * (z * (x * z)));
} else {
tmp = (1.0 / x) / y;
}
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)) .or. (.not. (z <= 1.0d0))) then
tmp = 1.0d0 / (y * (z * (x * z)))
else
tmp = (1.0d0 / x) / y
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) || !(z <= 1.0)) {
tmp = 1.0 / (y * (z * (x * z)));
} else {
tmp = (1.0 / x) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = 1.0 / (y * (z * (x * z))) else: tmp = (1.0 / x) / y return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(1.0 / Float64(y * Float64(z * Float64(x * z)))); else tmp = Float64(Float64(1.0 / x) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z <= -1.0) || ~((z <= 1.0)))
tmp = 1.0 / (y * (z * (x * z)));
else
tmp = (1.0 / x) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(1.0 / N[(y * N[(z * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{1}{y \cdot \left(z \cdot \left(x \cdot z\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 80.6%
associate-/r*80.5%
+-commutative80.5%
fma-def80.5%
Simplified80.5%
fma-udef80.5%
+-commutative80.5%
associate-/r*80.6%
associate-/r*80.8%
div-inv80.7%
add-sqr-sqrt80.7%
times-frac82.6%
hypot-1-def82.6%
hypot-1-def96.5%
Applied egg-rr96.5%
clear-num96.4%
frac-times91.3%
*-un-lft-identity91.3%
div-inv91.3%
remove-double-div91.3%
*-commutative91.3%
Applied egg-rr91.3%
Taylor expanded in z around inf 79.7%
unpow279.7%
associate-*r*90.5%
Simplified90.5%
if -1 < z < 1Initial program 99.7%
associate-/r*98.6%
+-commutative98.6%
fma-def98.6%
Simplified98.6%
Taylor expanded in z around 0 98.3%
metadata-eval98.3%
frac-times99.3%
Applied egg-rr99.3%
associate-*l/99.4%
*-un-lft-identity99.4%
Applied egg-rr99.4%
Final simplification94.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (/ 1.0 (* z (* y (* x z)))) (/ (/ 1.0 x) y)))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = 1.0 / (z * (y * (x * z)));
} else {
tmp = (1.0 / x) / y;
}
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)) .or. (.not. (z <= 1.0d0))) then
tmp = 1.0d0 / (z * (y * (x * z)))
else
tmp = (1.0d0 / x) / y
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) || !(z <= 1.0)) {
tmp = 1.0 / (z * (y * (x * z)));
} else {
tmp = (1.0 / x) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = 1.0 / (z * (y * (x * z))) else: tmp = (1.0 / x) / y return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(1.0 / Float64(z * Float64(y * Float64(x * z)))); else tmp = Float64(Float64(1.0 / x) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z <= -1.0) || ~((z <= 1.0)))
tmp = 1.0 / (z * (y * (x * z)));
else
tmp = (1.0 / x) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(1.0 / N[(z * N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{1}{z \cdot \left(y \cdot \left(x \cdot z\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 80.6%
associate-/r*80.5%
+-commutative80.5%
fma-def80.5%
Simplified80.5%
Taylor expanded in z around inf 79.7%
unpow279.7%
*-commutative79.7%
associate-*l*80.1%
*-commutative80.1%
associate-*l*87.4%
Simplified87.4%
Taylor expanded in z around 0 91.1%
if -1 < z < 1Initial program 99.7%
associate-/r*98.6%
+-commutative98.6%
fma-def98.6%
Simplified98.6%
Taylor expanded in z around 0 98.3%
metadata-eval98.3%
frac-times99.3%
Applied egg-rr99.3%
associate-*l/99.4%
*-un-lft-identity99.4%
Applied egg-rr99.4%
Final simplification95.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (or (<= z -1.1) (not (<= z 1.0))) (/ (/ (/ 1.0 y) z) (* x z)) (/ (/ 1.0 x) y)))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.1) || !(z <= 1.0)) {
tmp = ((1.0 / y) / z) / (x * z);
} else {
tmp = (1.0 / x) / y;
}
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.1d0)) .or. (.not. (z <= 1.0d0))) then
tmp = ((1.0d0 / y) / z) / (x * z)
else
tmp = (1.0d0 / x) / y
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.1) || !(z <= 1.0)) {
tmp = ((1.0 / y) / z) / (x * z);
} else {
tmp = (1.0 / x) / y;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z <= -1.1) or not (z <= 1.0): tmp = ((1.0 / y) / z) / (x * z) else: tmp = (1.0 / x) / y return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if ((z <= -1.1) || !(z <= 1.0)) tmp = Float64(Float64(Float64(1.0 / y) / z) / Float64(x * z)); else tmp = Float64(Float64(1.0 / x) / y); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z <= -1.1) || ~((z <= 1.0)))
tmp = ((1.0 / y) / z) / (x * z);
else
tmp = (1.0 / x) / y;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[Or[LessEqual[z, -1.1], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(N[(1.0 / y), $MachinePrecision] / z), $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{\frac{\frac{1}{y}}{z}}{x \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\end{array}
\end{array}
if z < -1.1000000000000001 or 1 < z Initial program 80.6%
associate-/r*80.5%
+-commutative80.5%
fma-def80.5%
Simplified80.5%
Taylor expanded in z around inf 79.7%
unpow279.7%
*-commutative79.7%
associate-*l*80.1%
*-commutative80.1%
associate-*l*87.4%
Simplified87.4%
Taylor expanded in z around 0 91.1%
associate-/r*91.8%
*-un-lft-identity91.8%
associate-*r*93.9%
*-commutative93.9%
*-commutative93.9%
times-frac89.6%
*-commutative89.6%
Applied egg-rr89.6%
associate-/r*89.6%
frac-times96.2%
*-un-lft-identity96.2%
associate-/l/96.1%
associate-/r*96.3%
*-commutative96.3%
Applied egg-rr96.3%
if -1.1000000000000001 < z < 1Initial program 99.7%
associate-/r*98.6%
+-commutative98.6%
fma-def98.6%
Simplified98.6%
Taylor expanded in z around 0 98.3%
metadata-eval98.3%
frac-times99.3%
Applied egg-rr99.3%
associate-*l/99.4%
*-un-lft-identity99.4%
Applied egg-rr99.4%
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 -1.0) (/ (/ 1.0 x) (* z (* z y))) (if (<= z 1.0) (/ (/ 1.0 x) y) (/ 1.0 (* z (* y (* x z)))))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = (1.0 / x) / (z * (z * y));
} else if (z <= 1.0) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / (z * (y * (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 <= (-1.0d0)) then
tmp = (1.0d0 / x) / (z * (z * y))
else if (z <= 1.0d0) then
tmp = (1.0d0 / x) / y
else
tmp = 1.0d0 / (z * (y * (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 <= -1.0) {
tmp = (1.0 / x) / (z * (z * y));
} else if (z <= 1.0) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / (z * (y * (x * z)));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if z <= -1.0: tmp = (1.0 / x) / (z * (z * y)) elif z <= 1.0: tmp = (1.0 / x) / y else: tmp = 1.0 / (z * (y * (x * 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 / x) / Float64(z * Float64(z * y))); elseif (z <= 1.0) tmp = Float64(Float64(1.0 / x) / y); else tmp = Float64(1.0 / Float64(z * Float64(y * 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 <= -1.0)
tmp = (1.0 / x) / (z * (z * y));
elseif (z <= 1.0)
tmp = (1.0 / x) / y;
else
tmp = 1.0 / (z * (y * (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[z, -1.0], N[(N[(1.0 / x), $MachinePrecision] / N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision], N[(1.0 / N[(z * N[(y * N[(x * 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}{x}}{z \cdot \left(z \cdot y\right)}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z \cdot \left(y \cdot \left(x \cdot z\right)\right)}\\
\end{array}
\end{array}
if z < -1Initial program 77.3%
associate-/r*77.2%
+-commutative77.2%
fma-def77.2%
Simplified77.2%
Taylor expanded in z around inf 77.2%
unpow277.2%
*-commutative77.2%
associate-*l*79.9%
*-commutative79.9%
associate-*l*87.6%
Simplified87.6%
Taylor expanded in z around 0 89.3%
associate-/r*90.6%
*-un-lft-identity90.6%
associate-*r*93.5%
*-commutative93.5%
*-commutative93.5%
times-frac92.2%
*-commutative92.2%
Applied egg-rr92.2%
associate-/l/92.3%
un-div-inv92.4%
*-commutative92.4%
*-commutative92.4%
Applied egg-rr92.4%
if -1 < z < 1Initial program 99.7%
associate-/r*98.6%
+-commutative98.6%
fma-def98.6%
Simplified98.6%
Taylor expanded in z around 0 98.3%
metadata-eval98.3%
frac-times99.3%
Applied egg-rr99.3%
associate-*l/99.4%
*-un-lft-identity99.4%
Applied egg-rr99.4%
if 1 < z Initial program 83.5%
associate-/r*83.5%
+-commutative83.5%
fma-def83.5%
Simplified83.5%
Taylor expanded in z around inf 81.9%
unpow281.9%
*-commutative81.9%
associate-*l*80.3%
*-commutative80.3%
associate-*l*87.2%
Simplified87.2%
Taylor expanded in z around 0 92.8%
Final simplification95.9%
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 z) x) (* z y)) (if (<= z 1.0) (/ (/ 1.0 x) y) (/ (/ (/ 1.0 y) z) (* x z)))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = ((1.0 / z) / x) / (z * y);
} else if (z <= 1.0) {
tmp = (1.0 / x) / y;
} 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 <= (-1.0d0)) then
tmp = ((1.0d0 / z) / x) / (z * y)
else if (z <= 1.0d0) then
tmp = (1.0d0 / x) / y
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 <= -1.0) {
tmp = ((1.0 / z) / x) / (z * y);
} else if (z <= 1.0) {
tmp = (1.0 / x) / y;
} else {
tmp = ((1.0 / y) / z) / (x * z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if z <= -1.0: tmp = ((1.0 / z) / x) / (z * y) elif z <= 1.0: tmp = (1.0 / x) / y else: tmp = ((1.0 / y) / z) / (x * z) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(Float64(Float64(1.0 / z) / x) / Float64(z * y)); elseif (z <= 1.0) tmp = Float64(Float64(1.0 / x) / y); else tmp = Float64(Float64(Float64(1.0 / y) / 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 <= -1.0)
tmp = ((1.0 / z) / x) / (z * y);
elseif (z <= 1.0)
tmp = (1.0 / x) / y;
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[z, -1.0], N[(N[(N[(1.0 / z), $MachinePrecision] / x), $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(1.0 / y), $MachinePrecision] / z), $MachinePrecision] / N[(x * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;\frac{\frac{\frac{1}{z}}{x}}{z \cdot y}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{y}}{z}}{x \cdot z}\\
\end{array}
\end{array}
if z < -1Initial program 77.3%
associate-/r*77.2%
+-commutative77.2%
fma-def77.2%
Simplified77.2%
Taylor expanded in z around inf 77.2%
unpow277.2%
*-commutative77.2%
associate-*l*79.9%
*-commutative79.9%
associate-*l*87.6%
Simplified87.6%
expm1-log1p-u84.0%
expm1-udef63.1%
associate-/r*63.1%
associate-*r*66.0%
*-commutative66.0%
Applied egg-rr66.0%
expm1-def86.9%
expm1-log1p93.5%
associate-/r*94.4%
*-commutative94.4%
Simplified94.4%
if -1 < z < 1Initial program 99.7%
associate-/r*98.6%
+-commutative98.6%
fma-def98.6%
Simplified98.6%
Taylor expanded in z around 0 98.3%
metadata-eval98.3%
frac-times99.3%
Applied egg-rr99.3%
associate-*l/99.4%
*-un-lft-identity99.4%
Applied egg-rr99.4%
if 1 < z Initial program 83.5%
associate-/r*83.5%
+-commutative83.5%
fma-def83.5%
Simplified83.5%
Taylor expanded in z around inf 81.9%
unpow281.9%
*-commutative81.9%
associate-*l*80.3%
*-commutative80.3%
associate-*l*87.2%
Simplified87.2%
Taylor expanded in z around 0 92.8%
associate-/r*92.9%
*-un-lft-identity92.9%
associate-*r*94.2%
*-commutative94.2%
*-commutative94.2%
times-frac87.3%
*-commutative87.3%
Applied egg-rr87.3%
associate-/r*87.3%
frac-times98.0%
*-un-lft-identity98.0%
associate-/l/97.9%
associate-/r*98.0%
*-commutative98.0%
Applied egg-rr98.0%
Final simplification97.8%
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(1.0 / Float64(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[(1.0 / N[(x * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{x \cdot y}
\end{array}
Initial program 89.8%
associate-/r*89.3%
+-commutative89.3%
fma-def89.3%
Simplified89.3%
Taylor expanded in z around 0 57.8%
Final simplification57.8%
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 89.8%
associate-/r*89.3%
+-commutative89.3%
fma-def89.3%
Simplified89.3%
Taylor expanded in z around 0 57.8%
metadata-eval57.8%
frac-times57.9%
Applied egg-rr57.9%
associate-*l/57.9%
*-un-lft-identity57.9%
Applied egg-rr57.9%
Final simplification57.9%
(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 2023182
(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)))))