
(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 8 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 5e+303) (/ (/ 1.0 x) t_0) (/ (/ 1.0 z) (* y (* x 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 <= 5e+303) {
tmp = (1.0 / x) / t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = y * (1.0d0 + (z * z))
if (t_0 <= 5d+303) then
tmp = (1.0d0 / x) / t_0
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 t_0 = y * (1.0 + (z * z));
double tmp;
if (t_0 <= 5e+303) {
tmp = (1.0 / x) / t_0;
} else {
tmp = (1.0 / z) / (y * (x * 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 <= 5e+303: tmp = (1.0 / x) / t_0 else: tmp = (1.0 / z) / (y * (x * 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 <= 5e+303) tmp = Float64(Float64(1.0 / x) / t_0); else tmp = Float64(Float64(1.0 / z) / Float64(y * Float64(x * 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 <= 5e+303)
tmp = (1.0 / x) / t_0;
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_] := Block[{t$95$0 = N[(y * N[(1.0 + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e+303], N[(N[(1.0 / x), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] / N[(y * N[(x * z), $MachinePrecision]), $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 5 \cdot 10^{+303}:\\
\;\;\;\;\frac{\frac{1}{x}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y \cdot \left(x \cdot z\right)}\\
\end{array}
\end{array}
if (*.f64 y (+.f64 1 (*.f64 z z))) < 4.9999999999999997e303Initial program 95.8%
if 4.9999999999999997e303 < (*.f64 y (+.f64 1 (*.f64 z z))) Initial program 78.2%
associate-/r*78.1%
+-commutative78.1%
fma-def78.1%
Simplified78.1%
fma-udef78.1%
+-commutative78.1%
associate-/r*78.2%
associate-/r*78.1%
div-inv78.1%
add-sqr-sqrt78.1%
times-frac78.1%
hypot-1-def78.1%
hypot-1-def98.8%
Applied egg-rr98.8%
Taylor expanded in z around inf 78.1%
unpow278.1%
Simplified78.1%
associate-/r*78.1%
*-un-lft-identity78.1%
associate-*l*86.3%
times-frac99.7%
Applied egg-rr99.7%
associate-/l/99.9%
un-div-inv99.9%
*-commutative99.9%
Applied egg-rr99.9%
Final simplification96.4%
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 93.3%
associate-/r*92.5%
+-commutative92.5%
fma-def92.5%
Simplified92.5%
fma-udef92.5%
+-commutative92.5%
associate-/r*93.3%
associate-/r*91.5%
div-inv91.4%
add-sqr-sqrt91.4%
times-frac92.5%
hypot-1-def92.5%
hypot-1-def97.6%
Applied egg-rr97.6%
Final simplification97.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* z z) 2e+301) (/ 1.0 (* x (+ y (* y (* z z))))) (/ (/ 1.0 z) (* y (* x z)))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e+301) {
tmp = 1.0 / (x * (y + (y * (z * z))));
} 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 * z) <= 2d+301) then
tmp = 1.0d0 / (x * (y + (y * (z * z))))
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 * z) <= 2e+301) {
tmp = 1.0 / (x * (y + (y * (z * z))));
} else {
tmp = (1.0 / z) / (y * (x * z));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 2e+301: tmp = 1.0 / (x * (y + (y * (z * z)))) else: tmp = (1.0 / z) / (y * (x * z)) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 2e+301) tmp = Float64(1.0 / Float64(x * Float64(y + Float64(y * Float64(z * z))))); else tmp = Float64(Float64(1.0 / 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 * z) <= 2e+301)
tmp = 1.0 / (x * (y + (y * (z * z))));
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[N[(z * z), $MachinePrecision], 2e+301], N[(1.0 / N[(x * N[(y + N[(y * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] / N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+301}:\\
\;\;\;\;\frac{1}{x \cdot \left(y + y \cdot \left(z \cdot z\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y \cdot \left(x \cdot z\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 2.00000000000000011e301Initial program 98.2%
associate-/r*97.2%
+-commutative97.2%
fma-def97.2%
Simplified97.2%
fma-udef97.2%
distribute-lft-in97.2%
*-rgt-identity97.2%
Applied egg-rr97.2%
if 2.00000000000000011e301 < (*.f64 z z) Initial program 76.6%
associate-/r*76.6%
+-commutative76.6%
fma-def76.6%
Simplified76.6%
fma-udef76.6%
+-commutative76.6%
associate-/r*76.6%
associate-/r*76.3%
div-inv76.3%
add-sqr-sqrt76.3%
times-frac76.6%
hypot-1-def76.6%
hypot-1-def99.2%
Applied egg-rr99.2%
Taylor expanded in z around inf 76.6%
unpow276.6%
Simplified76.6%
associate-/r*76.6%
*-un-lft-identity76.6%
associate-*l*89.9%
times-frac98.1%
Applied egg-rr98.1%
associate-/l/98.2%
un-div-inv99.8%
*-commutative99.8%
Applied egg-rr99.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) 0.2) (/ (/ 1.0 x) y) (/ 1.0 (* x (* z (* z y))))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 0.2) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / (x * (z * (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) <= 0.2d0) then
tmp = (1.0d0 / x) / y
else
tmp = 1.0d0 / (x * (z * (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) <= 0.2) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / (x * (z * (z * y)));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 0.2: tmp = (1.0 / x) / y else: tmp = 1.0 / (x * (z * (z * y))) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 0.2) tmp = Float64(Float64(1.0 / x) / y); else tmp = Float64(1.0 / Float64(x * Float64(z * 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) <= 0.2)
tmp = (1.0 / x) / y;
else
tmp = 1.0 / (x * (z * (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], 0.2], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision], N[(1.0 / N[(x * N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 0.2:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \left(z \cdot \left(z \cdot y\right)\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 0.20000000000000001Initial program 99.6%
associate-/r*98.4%
+-commutative98.4%
fma-def98.4%
Simplified98.4%
fma-udef98.4%
+-commutative98.4%
associate-/r*99.6%
associate-/r*99.0%
div-inv98.9%
add-sqr-sqrt98.9%
times-frac99.5%
hypot-1-def99.5%
hypot-1-def99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 98.3%
associate-/r*99.7%
*-commutative99.7%
unpow299.7%
fma-udef99.7%
Simplified99.7%
fma-udef99.7%
distribute-rgt-in99.7%
associate-*l*99.7%
*-un-lft-identity99.7%
Applied egg-rr99.7%
Taylor expanded in z around 0 96.7%
associate-/l/97.8%
Simplified97.8%
if 0.20000000000000001 < (*.f64 z z) Initial program 87.0%
associate-/r*86.7%
+-commutative86.7%
fma-def86.7%
Simplified86.7%
Taylor expanded in z around inf 85.5%
unpow285.5%
*-commutative85.5%
associate-*r*92.2%
Simplified92.2%
Final simplification95.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* z z) 0.2) (/ (/ 1.0 x) y) (/ 1.0 (* (* x z) (* z y)))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 0.2) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / ((x * z) * (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) <= 0.2d0) then
tmp = (1.0d0 / x) / y
else
tmp = 1.0d0 / ((x * z) * (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) <= 0.2) {
tmp = (1.0 / x) / y;
} else {
tmp = 1.0 / ((x * z) * (z * y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 0.2: tmp = (1.0 / x) / y else: tmp = 1.0 / ((x * z) * (z * y)) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 0.2) tmp = Float64(Float64(1.0 / x) / y); else tmp = Float64(1.0 / Float64(Float64(x * z) * 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) <= 0.2)
tmp = (1.0 / x) / y;
else
tmp = 1.0 / ((x * z) * (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], 0.2], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision], N[(1.0 / N[(N[(x * z), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 0.2:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(x \cdot z\right) \cdot \left(z \cdot y\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 0.20000000000000001Initial program 99.6%
associate-/r*98.4%
+-commutative98.4%
fma-def98.4%
Simplified98.4%
fma-udef98.4%
+-commutative98.4%
associate-/r*99.6%
associate-/r*99.0%
div-inv98.9%
add-sqr-sqrt98.9%
times-frac99.5%
hypot-1-def99.5%
hypot-1-def99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 98.3%
associate-/r*99.7%
*-commutative99.7%
unpow299.7%
fma-udef99.7%
Simplified99.7%
fma-udef99.7%
distribute-rgt-in99.7%
associate-*l*99.7%
*-un-lft-identity99.7%
Applied egg-rr99.7%
Taylor expanded in z around 0 96.7%
associate-/l/97.8%
Simplified97.8%
if 0.20000000000000001 < (*.f64 z z) Initial program 87.0%
associate-/r*86.7%
+-commutative86.7%
fma-def86.7%
Simplified86.7%
fma-udef86.7%
+-commutative86.7%
associate-/r*87.0%
associate-/r*83.9%
div-inv83.9%
add-sqr-sqrt83.9%
times-frac85.4%
hypot-1-def85.4%
hypot-1-def95.7%
Applied egg-rr95.7%
Taylor expanded in z around inf 83.3%
unpow283.3%
Simplified83.3%
associate-/r*83.5%
*-un-lft-identity83.5%
associate-*l*89.6%
times-frac92.6%
Applied egg-rr92.6%
associate-*r/94.5%
frac-times94.0%
metadata-eval94.0%
*-commutative94.0%
associate-/r*93.7%
*-commutative93.7%
Applied egg-rr93.7%
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) 0.2) (/ (/ 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 * z) <= 0.2) {
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 * z) <= 0.2d0) 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 * z) <= 0.2) {
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 * z) <= 0.2: 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 (Float64(z * z) <= 0.2) tmp = Float64(Float64(1.0 / x) / y); else tmp = Float64(Float64(1.0 / 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 * z) <= 0.2)
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[N[(z * z), $MachinePrecision], 0.2], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] / N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 0.2:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{y \cdot \left(x \cdot z\right)}\\
\end{array}
\end{array}
if (*.f64 z z) < 0.20000000000000001Initial program 99.6%
associate-/r*98.4%
+-commutative98.4%
fma-def98.4%
Simplified98.4%
fma-udef98.4%
+-commutative98.4%
associate-/r*99.6%
associate-/r*99.0%
div-inv98.9%
add-sqr-sqrt98.9%
times-frac99.5%
hypot-1-def99.5%
hypot-1-def99.5%
Applied egg-rr99.5%
Taylor expanded in x around 0 98.3%
associate-/r*99.7%
*-commutative99.7%
unpow299.7%
fma-udef99.7%
Simplified99.7%
fma-udef99.7%
distribute-rgt-in99.7%
associate-*l*99.7%
*-un-lft-identity99.7%
Applied egg-rr99.7%
Taylor expanded in z around 0 96.7%
associate-/l/97.8%
Simplified97.8%
if 0.20000000000000001 < (*.f64 z z) Initial program 87.0%
associate-/r*86.7%
+-commutative86.7%
fma-def86.7%
Simplified86.7%
fma-udef86.7%
+-commutative86.7%
associate-/r*87.0%
associate-/r*83.9%
div-inv83.9%
add-sqr-sqrt83.9%
times-frac85.4%
hypot-1-def85.4%
hypot-1-def95.7%
Applied egg-rr95.7%
Taylor expanded in z around inf 83.3%
unpow283.3%
Simplified83.3%
associate-/r*83.5%
*-un-lft-identity83.5%
associate-*l*89.6%
times-frac92.6%
Applied egg-rr92.6%
associate-/l/92.6%
un-div-inv94.9%
*-commutative94.9%
Applied egg-rr94.9%
Final simplification96.4%
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 93.3%
associate-/r*92.5%
+-commutative92.5%
fma-def92.5%
Simplified92.5%
Taylor expanded in z around 0 58.0%
Final simplification58.0%
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 93.3%
associate-/r*92.5%
+-commutative92.5%
fma-def92.5%
Simplified92.5%
fma-udef92.5%
+-commutative92.5%
associate-/r*93.3%
associate-/r*91.5%
div-inv91.4%
add-sqr-sqrt91.4%
times-frac92.5%
hypot-1-def92.5%
hypot-1-def97.6%
Applied egg-rr97.6%
Taylor expanded in x around 0 91.4%
associate-/r*92.2%
*-commutative92.2%
unpow292.2%
fma-udef92.2%
Simplified92.2%
fma-udef92.2%
distribute-rgt-in92.2%
associate-*l*95.3%
*-un-lft-identity95.3%
Applied egg-rr95.3%
Taylor expanded in z around 0 58.0%
associate-/l/58.4%
Simplified58.4%
Final simplification58.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 2023214
(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)))))