
(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 (if (<= (* z z) 2e+214) (/ (/ 1.0 y) (+ x (* (pow z 2.0) x))) (/ (/ (/ 1.0 x) z) (* z y))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e+214) {
tmp = (1.0 / y) / (x + (pow(z, 2.0) * x));
} 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) <= 2d+214) then
tmp = (1.0d0 / y) / (x + ((z ** 2.0d0) * x))
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) <= 2e+214) {
tmp = (1.0 / y) / (x + (Math.pow(z, 2.0) * x));
} 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) <= 2e+214: tmp = (1.0 / y) / (x + (math.pow(z, 2.0) * x)) 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) <= 2e+214) tmp = Float64(Float64(1.0 / y) / Float64(x + Float64((z ^ 2.0) * x))); else tmp = Float64(Float64(Float64(1.0 / 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) <= 2e+214)
tmp = (1.0 / y) / (x + ((z ^ 2.0) * x));
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], 2e+214], N[(N[(1.0 / y), $MachinePrecision] / N[(x + N[(N[Power[z, 2.0], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] / z), $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^{+214}:\\
\;\;\;\;\frac{\frac{1}{y}}{x + {z}^{2} \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{x}}{z}}{z \cdot y}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.9999999999999999e214Initial program 98.1%
associate-/r*98.0%
associate-/l/98.1%
associate-/r*98.4%
associate-/l/98.1%
sqr-neg98.1%
+-commutative98.1%
sqr-neg98.1%
fma-def98.1%
Simplified98.1%
fma-udef98.1%
distribute-rgt-in98.1%
pow298.1%
*-un-lft-identity98.1%
Applied egg-rr98.1%
if 1.9999999999999999e214 < (*.f64 z z) Initial program 75.5%
Taylor expanded in z around inf 75.5%
associate-*r*76.7%
associate-/r*77.3%
associate-/l/77.3%
Simplified77.3%
div-inv77.3%
unpow277.3%
times-frac99.2%
Applied egg-rr99.2%
*-commutative99.2%
associate-/l/99.2%
un-div-inv99.2%
*-commutative99.2%
Applied egg-rr99.2%
Final simplification98.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* z z) 2e+214) (/ (/ 1.0 y) (* x (fma z z 1.0))) (/ (/ (/ 1.0 x) z) (* z y))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 2e+214) {
tmp = (1.0 / y) / (x * fma(z, z, 1.0));
} 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) <= 2e+214) tmp = Float64(Float64(1.0 / y) / Float64(x * fma(z, z, 1.0))); else tmp = Float64(Float64(Float64(1.0 / x) / z) / Float64(z * y)); end return 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+214], N[(N[(1.0 / y), $MachinePrecision] / N[(x * N[(z * z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] / z), $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^{+214}:\\
\;\;\;\;\frac{\frac{1}{y}}{x \cdot \mathsf{fma}\left(z, z, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{x}}{z}}{z \cdot y}\\
\end{array}
\end{array}
if (*.f64 z z) < 1.9999999999999999e214Initial program 98.1%
associate-/r*98.0%
associate-/l/98.1%
associate-/r*98.4%
associate-/l/98.1%
sqr-neg98.1%
+-commutative98.1%
sqr-neg98.1%
fma-def98.1%
Simplified98.1%
if 1.9999999999999999e214 < (*.f64 z z) Initial program 75.5%
Taylor expanded in z around inf 75.5%
associate-*r*76.7%
associate-/r*77.3%
associate-/l/77.3%
Simplified77.3%
div-inv77.3%
unpow277.3%
times-frac99.2%
Applied egg-rr99.2%
*-commutative99.2%
associate-/l/99.2%
un-div-inv99.2%
*-commutative99.2%
Applied egg-rr99.2%
Final simplification98.4%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (+ (* z z) 1.0))))
(if (<= t_0 5e+306)
(/ (/ 1.0 x) t_0)
(* (/ 1.0 z) (* (/ 1.0 y) (/ (/ 1.0 x) z))))))assert(x < y);
double code(double x, double y, double z) {
double t_0 = y * ((z * z) + 1.0);
double tmp;
if (t_0 <= 5e+306) {
tmp = (1.0 / x) / t_0;
} else {
tmp = (1.0 / z) * ((1.0 / y) * ((1.0 / 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 * ((z * z) + 1.0d0)
if (t_0 <= 5d+306) then
tmp = (1.0d0 / x) / t_0
else
tmp = (1.0d0 / z) * ((1.0d0 / y) * ((1.0d0 / 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 * ((z * z) + 1.0);
double tmp;
if (t_0 <= 5e+306) {
tmp = (1.0 / x) / t_0;
} else {
tmp = (1.0 / z) * ((1.0 / y) * ((1.0 / x) / z));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): t_0 = y * ((z * z) + 1.0) tmp = 0 if t_0 <= 5e+306: tmp = (1.0 / x) / t_0 else: tmp = (1.0 / z) * ((1.0 / y) * ((1.0 / x) / z)) return tmp
x, y = sort([x, y]) function code(x, y, z) t_0 = Float64(y * Float64(Float64(z * z) + 1.0)) tmp = 0.0 if (t_0 <= 5e+306) tmp = Float64(Float64(1.0 / x) / t_0); else tmp = Float64(Float64(1.0 / z) * Float64(Float64(1.0 / y) * Float64(Float64(1.0 / x) / z))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
t_0 = y * ((z * z) + 1.0);
tmp = 0.0;
if (t_0 <= 5e+306)
tmp = (1.0 / x) / t_0;
else
tmp = (1.0 / z) * ((1.0 / y) * ((1.0 / 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[(N[(z * z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e+306], N[(N[(1.0 / x), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] * N[(N[(1.0 / y), $MachinePrecision] * N[(N[(1.0 / x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y \cdot \left(z \cdot z + 1\right)\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{+306}:\\
\;\;\;\;\frac{\frac{1}{x}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \left(\frac{1}{y} \cdot \frac{\frac{1}{x}}{z}\right)\\
\end{array}
\end{array}
if (*.f64 y (+.f64 1 (*.f64 z z))) < 4.99999999999999993e306Initial program 96.9%
if 4.99999999999999993e306 < (*.f64 y (+.f64 1 (*.f64 z z))) Initial program 59.4%
Taylor expanded in z around inf 59.4%
associate-*r*72.4%
associate-/r*72.4%
associate-/l/72.4%
Simplified72.4%
*-un-lft-identity72.4%
unpow272.4%
times-frac91.3%
Applied egg-rr91.3%
div-inv91.3%
*-un-lft-identity91.3%
times-frac99.6%
Applied egg-rr99.6%
Final simplification97.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+28) (/ (/ 1.0 x) (* y (+ (* z z) 1.0))) (* (/ (/ 1.0 x) z) (/ (/ 1.0 y) z))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 5e+28) {
tmp = (1.0 / x) / (y * ((z * z) + 1.0));
} else {
tmp = ((1.0 / x) / z) * ((1.0 / 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) <= 5d+28) then
tmp = (1.0d0 / x) / (y * ((z * z) + 1.0d0))
else
tmp = ((1.0d0 / x) / z) * ((1.0d0 / 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) <= 5e+28) {
tmp = (1.0 / x) / (y * ((z * z) + 1.0));
} else {
tmp = ((1.0 / x) / z) * ((1.0 / y) / z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z * z) <= 5e+28: tmp = (1.0 / x) / (y * ((z * z) + 1.0)) else: tmp = ((1.0 / x) / z) * ((1.0 / y) / z) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (Float64(z * z) <= 5e+28) tmp = Float64(Float64(1.0 / x) / Float64(y * Float64(Float64(z * z) + 1.0))); else tmp = Float64(Float64(Float64(1.0 / x) / z) * Float64(Float64(1.0 / 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) <= 5e+28)
tmp = (1.0 / x) / (y * ((z * z) + 1.0));
else
tmp = ((1.0 / x) / z) * ((1.0 / 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], 5e+28], N[(N[(1.0 / x), $MachinePrecision] / N[(y * N[(N[(z * z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] / z), $MachinePrecision] * N[(N[(1.0 / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+28}:\\
\;\;\;\;\frac{\frac{1}{x}}{y \cdot \left(z \cdot z + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{z} \cdot \frac{\frac{1}{y}}{z}\\
\end{array}
\end{array}
if (*.f64 z z) < 4.99999999999999957e28Initial program 99.7%
if 4.99999999999999957e28 < (*.f64 z z) Initial program 83.4%
Taylor expanded in z around inf 83.4%
associate-*r*84.8%
associate-/r*85.1%
associate-/l/85.1%
Simplified85.1%
div-inv85.1%
unpow285.1%
times-frac96.4%
Applied egg-rr96.4%
Final simplification98.1%
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) y) (* (/ (/ 1.0 x) z) (/ (/ 1.0 y) z))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / x) / y;
} else {
tmp = ((1.0 / x) / z) * ((1.0 / 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 / x) / y
else
tmp = ((1.0d0 / x) / z) * ((1.0d0 / 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 / x) / y;
} else {
tmp = ((1.0 / x) / z) * ((1.0 / y) / z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if z <= 1.0: tmp = (1.0 / x) / y else: tmp = ((1.0 / x) / z) * ((1.0 / 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 / x) / y); else tmp = Float64(Float64(Float64(1.0 / x) / z) * Float64(Float64(1.0 / 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 / x) / y;
else
tmp = ((1.0 / x) / z) * ((1.0 / 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 / x), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] / z), $MachinePrecision] * N[(N[(1.0 / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{z} \cdot \frac{\frac{1}{y}}{z}\\
\end{array}
\end{array}
if z < 1Initial program 95.2%
Taylor expanded in z around 0 72.3%
if 1 < z Initial program 83.5%
Taylor expanded in z around inf 81.4%
associate-*r*85.0%
associate-/r*84.9%
associate-/l/85.0%
Simplified85.0%
div-inv84.9%
unpow284.9%
times-frac92.7%
Applied egg-rr92.7%
Final simplification78.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 x) y) (/ (/ 1.0 y) (* z (* z x)))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / x) / y;
} else {
tmp = (1.0 / y) / (z * (z * x));
}
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) / y
else
tmp = (1.0d0 / y) / (z * (z * x))
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) / y;
} else {
tmp = (1.0 / y) / (z * (z * x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if z <= 1.0: tmp = (1.0 / x) / y else: tmp = (1.0 / y) / (z * (z * x)) 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) / y); else tmp = Float64(Float64(1.0 / y) / Float64(z * Float64(z * x))); 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) / y;
else
tmp = (1.0 / y) / (z * (z * x));
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] / y), $MachinePrecision], N[(N[(1.0 / y), $MachinePrecision] / N[(z * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y}}{z \cdot \left(z \cdot x\right)}\\
\end{array}
\end{array}
if z < 1Initial program 95.2%
Taylor expanded in z around 0 72.3%
if 1 < z Initial program 83.5%
Taylor expanded in z around inf 81.4%
associate-*r*85.0%
associate-/r*84.9%
associate-/l/85.0%
Simplified85.0%
*-un-lft-identity85.0%
unpow285.0%
times-frac93.6%
Applied egg-rr93.6%
*-commutative93.6%
associate-/l/93.6%
frac-times88.8%
associate-/r/88.8%
clear-num88.8%
*-commutative88.8%
Applied egg-rr88.8%
Final simplification77.2%
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) y) (/ (/ 1.0 z) (* z (* y x)))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / x) / y;
} else {
tmp = (1.0 / z) / (z * (y * x));
}
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) / y
else
tmp = (1.0d0 / z) / (z * (y * x))
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) / y;
} else {
tmp = (1.0 / z) / (z * (y * x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if z <= 1.0: tmp = (1.0 / x) / y else: tmp = (1.0 / z) / (z * (y * x)) 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) / y); else tmp = Float64(Float64(1.0 / z) / Float64(z * Float64(y * x))); 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) / y;
else
tmp = (1.0 / z) / (z * (y * x));
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] / y), $MachinePrecision], N[(N[(1.0 / z), $MachinePrecision] / N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z}}{z \cdot \left(y \cdot x\right)}\\
\end{array}
\end{array}
if z < 1Initial program 95.2%
Taylor expanded in z around 0 72.3%
if 1 < z Initial program 83.5%
Taylor expanded in z around inf 81.4%
associate-*r*85.0%
associate-/r*84.9%
associate-/l/85.0%
Simplified85.0%
*-un-lft-identity85.0%
unpow285.0%
times-frac93.6%
Applied egg-rr93.6%
clear-num93.7%
un-div-inv93.6%
associate-/l/93.7%
associate-/r/93.7%
/-rgt-identity93.7%
Applied egg-rr93.7%
Final simplification78.7%
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) y) (/ (/ 1.0 (* z y)) (* z x))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
tmp = (1.0 / x) / y;
} else {
tmp = (1.0 / (z * y)) / (z * x);
}
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) / y
else
tmp = (1.0d0 / (z * y)) / (z * x)
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) / y;
} else {
tmp = (1.0 / (z * y)) / (z * x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if z <= 1.0: tmp = (1.0 / x) / y else: tmp = (1.0 / (z * y)) / (z * x) 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) / y); else tmp = Float64(Float64(1.0 / Float64(z * y)) / Float64(z * x)); 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) / y;
else
tmp = (1.0 / (z * y)) / (z * x);
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] / y), $MachinePrecision], N[(N[(1.0 / N[(z * y), $MachinePrecision]), $MachinePrecision] / N[(z * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{z \cdot y}}{z \cdot x}\\
\end{array}
\end{array}
if z < 1Initial program 95.2%
Taylor expanded in z around 0 72.3%
if 1 < z Initial program 83.5%
Taylor expanded in z around inf 81.4%
associate-*r*85.0%
associate-/r*84.9%
associate-/l/85.0%
Simplified85.0%
div-inv84.9%
unpow284.9%
times-frac92.7%
Applied egg-rr92.7%
associate-/l/92.8%
un-div-inv92.9%
associate-/l/92.6%
*-commutative92.6%
*-commutative92.6%
Applied egg-rr92.6%
Final simplification78.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 x) y) (/ (/ (/ 1.0 x) z) (* z y))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (z <= 1.0) {
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 <= 1.0d0) 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 <= 1.0) {
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 <= 1.0: 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 (z <= 1.0) tmp = Float64(Float64(1.0 / x) / y); else tmp = Float64(Float64(Float64(1.0 / 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 <= 1.0)
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[z, 1.0], N[(N[(1.0 / x), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(1.0 / x), $MachinePrecision] / z), $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1:\\
\;\;\;\;\frac{\frac{1}{x}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{1}{x}}{z}}{z \cdot y}\\
\end{array}
\end{array}
if z < 1Initial program 95.2%
Taylor expanded in z around 0 72.3%
if 1 < z Initial program 83.5%
Taylor expanded in z around inf 81.4%
associate-*r*85.0%
associate-/r*84.9%
associate-/l/85.0%
Simplified85.0%
div-inv84.9%
unpow284.9%
times-frac92.7%
Applied egg-rr92.7%
*-commutative92.7%
associate-/l/92.6%
un-div-inv92.6%
*-commutative92.6%
Applied egg-rr92.6%
Final simplification78.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(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.8%
Taylor expanded in z around 0 55.6%
Final simplification55.6%
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.8%
Taylor expanded in z around 0 55.7%
Final simplification55.7%
(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 2023336
(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)))))