
(FPCore (x y z) :precision binary64 (/ (* x y) (* (* z z) (+ z 1.0))))
double code(double x, double y, double z) {
return (x * y) / ((z * z) * (z + 1.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * y) / ((z * z) * (z + 1.0d0))
end function
public static double code(double x, double y, double z) {
return (x * y) / ((z * z) * (z + 1.0));
}
def code(x, y, z): return (x * y) / ((z * z) * (z + 1.0))
function code(x, y, z) return Float64(Float64(x * y) / Float64(Float64(z * z) * Float64(z + 1.0))) end
function tmp = code(x, y, z) tmp = (x * y) / ((z * z) * (z + 1.0)); end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x y) (* (* z z) (+ z 1.0))))
double code(double x, double y, double z) {
return (x * y) / ((z * z) * (z + 1.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * y) / ((z * z) * (z + 1.0d0))
end function
public static double code(double x, double y, double z) {
return (x * y) / ((z * z) * (z + 1.0));
}
def code(x, y, z): return (x * y) / ((z * z) * (z + 1.0))
function code(x, y, z) return Float64(Float64(x * y) / Float64(Float64(z * z) * Float64(z + 1.0))) end
function tmp = code(x, y, z) tmp = (x * y) / ((z * z) * (z + 1.0)); end
code[x_, y_, z_] := N[(N[(x * y), $MachinePrecision] / N[(N[(z * z), $MachinePrecision] * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (/ (* (/ y (+ z 1.0)) (/ x z)) z))
assert(x < y);
double code(double x, double y, double z) {
return ((y / (z + 1.0)) * (x / z)) / z;
}
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 = ((y / (z + 1.0d0)) * (x / z)) / z
end function
assert x < y;
public static double code(double x, double y, double z) {
return ((y / (z + 1.0)) * (x / z)) / z;
}
[x, y] = sort([x, y]) def code(x, y, z): return ((y / (z + 1.0)) * (x / z)) / z
x, y = sort([x, y]) function code(x, y, z) return Float64(Float64(Float64(y / Float64(z + 1.0)) * Float64(x / z)) / z) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = ((y / (z + 1.0)) * (x / z)) / z;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(N[(N[(y / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{y}{z + 1} \cdot \frac{x}{z}}{z}
\end{array}
Initial program 80.4%
associate-*r/81.8%
sqr-neg81.8%
*-commutative81.8%
distribute-rgt1-in65.3%
sqr-neg65.3%
fma-def81.8%
sqr-neg81.8%
cube-unmult81.8%
Simplified81.8%
associate-*r/80.4%
fma-udef64.8%
cube-mult64.8%
distribute-rgt1-in80.4%
*-commutative80.4%
frac-times86.4%
*-commutative86.4%
associate-/r*91.6%
associate-*r/96.7%
Applied egg-rr96.7%
Final simplification96.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (or (<= z -130000.0) (not (<= z 1.0))) (* (/ x z) (/ (/ y z) z)) (/ (* y (/ x z)) z)))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z <= -130000.0) || !(z <= 1.0)) {
tmp = (x / z) * ((y / z) / z);
} else {
tmp = (y * (x / z)) / 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 <= (-130000.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = (x / z) * ((y / z) / z)
else
tmp = (y * (x / z)) / z
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -130000.0) || !(z <= 1.0)) {
tmp = (x / z) * ((y / z) / z);
} else {
tmp = (y * (x / z)) / z;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z <= -130000.0) or not (z <= 1.0): tmp = (x / z) * ((y / z) / z) else: tmp = (y * (x / z)) / z return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if ((z <= -130000.0) || !(z <= 1.0)) tmp = Float64(Float64(x / z) * Float64(Float64(y / z) / z)); else tmp = Float64(Float64(y * Float64(x / z)) / z); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z <= -130000.0) || ~((z <= 1.0)))
tmp = (x / z) * ((y / z) / z);
else
tmp = (y * (x / z)) / 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[Or[LessEqual[z, -130000.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * N[(N[(y / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -130000 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \frac{x}{z}}{z}\\
\end{array}
\end{array}
if z < -1.3e5 or 1 < z Initial program 78.7%
frac-times93.0%
associate-*l/91.0%
times-frac98.3%
Applied egg-rr98.3%
Taylor expanded in z around inf 97.1%
if -1.3e5 < z < 1Initial program 82.3%
associate-*r/79.4%
sqr-neg79.4%
*-commutative79.4%
distribute-rgt1-in79.4%
sqr-neg79.4%
fma-def79.4%
sqr-neg79.4%
cube-unmult79.4%
Simplified79.4%
associate-*r/82.3%
fma-udef82.3%
cube-mult82.3%
distribute-rgt1-in82.3%
*-commutative82.3%
frac-times79.2%
*-commutative79.2%
associate-/r*84.7%
associate-*r/94.5%
Applied egg-rr94.5%
Taylor expanded in z around 0 88.6%
*-commutative88.6%
associate-*r/93.6%
Simplified93.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 (or (<= z -130000.0) (not (<= z 1.0))) (/ (* (/ x z) (/ y z)) z) (/ (* y (/ x z)) z)))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z <= -130000.0) || !(z <= 1.0)) {
tmp = ((x / z) * (y / z)) / z;
} else {
tmp = (y * (x / z)) / 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 <= (-130000.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = ((x / z) * (y / z)) / z
else
tmp = (y * (x / z)) / z
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -130000.0) || !(z <= 1.0)) {
tmp = ((x / z) * (y / z)) / z;
} else {
tmp = (y * (x / z)) / z;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z <= -130000.0) or not (z <= 1.0): tmp = ((x / z) * (y / z)) / z else: tmp = (y * (x / z)) / z return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if ((z <= -130000.0) || !(z <= 1.0)) tmp = Float64(Float64(Float64(x / z) * Float64(y / z)) / z); else tmp = Float64(Float64(y * Float64(x / z)) / z); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z <= -130000.0) || ~((z <= 1.0)))
tmp = ((x / z) * (y / z)) / z;
else
tmp = (y * (x / z)) / 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[Or[LessEqual[z, -130000.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -130000 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{\frac{x}{z} \cdot \frac{y}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \frac{x}{z}}{z}\\
\end{array}
\end{array}
if z < -1.3e5 or 1 < z Initial program 78.7%
sqr-neg78.7%
times-frac93.0%
sqr-neg93.0%
Simplified93.0%
Taylor expanded in z around inf 91.7%
*-commutative91.7%
associate-/r*96.7%
associate-*r/97.3%
Applied egg-rr97.3%
if -1.3e5 < z < 1Initial program 82.3%
associate-*r/79.4%
sqr-neg79.4%
*-commutative79.4%
distribute-rgt1-in79.4%
sqr-neg79.4%
fma-def79.4%
sqr-neg79.4%
cube-unmult79.4%
Simplified79.4%
associate-*r/82.3%
fma-udef82.3%
cube-mult82.3%
distribute-rgt1-in82.3%
*-commutative82.3%
frac-times79.2%
*-commutative79.2%
associate-/r*84.7%
associate-*r/94.5%
Applied egg-rr94.5%
Taylor expanded in z around 0 88.6%
*-commutative88.6%
associate-*r/93.6%
Simplified93.6%
Final simplification95.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= z -130000.0) (/ (* (/ x z) (/ y z)) z) (if (<= z 1.0) (/ (* y (/ x z)) z) (/ (/ y z) (* z (/ z x))))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (z <= -130000.0) {
tmp = ((x / z) * (y / z)) / z;
} else if (z <= 1.0) {
tmp = (y * (x / z)) / z;
} else {
tmp = (y / z) / (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 <= (-130000.0d0)) then
tmp = ((x / z) * (y / z)) / z
else if (z <= 1.0d0) then
tmp = (y * (x / z)) / z
else
tmp = (y / z) / (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 <= -130000.0) {
tmp = ((x / z) * (y / z)) / z;
} else if (z <= 1.0) {
tmp = (y * (x / z)) / z;
} else {
tmp = (y / z) / (z * (z / x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if z <= -130000.0: tmp = ((x / z) * (y / z)) / z elif z <= 1.0: tmp = (y * (x / z)) / z else: tmp = (y / z) / (z * (z / x)) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (z <= -130000.0) tmp = Float64(Float64(Float64(x / z) * Float64(y / z)) / z); elseif (z <= 1.0) tmp = Float64(Float64(y * Float64(x / z)) / z); else tmp = Float64(Float64(y / z) / 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 <= -130000.0)
tmp = ((x / z) * (y / z)) / z;
elseif (z <= 1.0)
tmp = (y * (x / z)) / z;
else
tmp = (y / z) / (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, -130000.0], N[(N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 1.0], N[(N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(y / z), $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 -130000:\\
\;\;\;\;\frac{\frac{x}{z} \cdot \frac{y}{z}}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{y \cdot \frac{x}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{z \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if z < -1.3e5Initial program 79.4%
sqr-neg79.4%
times-frac93.0%
sqr-neg93.0%
Simplified93.0%
Taylor expanded in z around inf 91.8%
*-commutative91.8%
associate-/r*96.9%
associate-*r/97.3%
Applied egg-rr97.3%
if -1.3e5 < z < 1Initial program 82.3%
associate-*r/79.4%
sqr-neg79.4%
*-commutative79.4%
distribute-rgt1-in79.4%
sqr-neg79.4%
fma-def79.4%
sqr-neg79.4%
cube-unmult79.4%
Simplified79.4%
associate-*r/82.3%
fma-udef82.3%
cube-mult82.3%
distribute-rgt1-in82.3%
*-commutative82.3%
frac-times79.2%
*-commutative79.2%
associate-/r*84.7%
associate-*r/94.5%
Applied egg-rr94.5%
Taylor expanded in z around 0 88.6%
*-commutative88.6%
associate-*r/93.6%
Simplified93.6%
if 1 < z Initial program 78.0%
frac-times92.9%
associate-*l/90.2%
times-frac98.1%
Applied egg-rr98.1%
Taylor expanded in z around inf 96.9%
*-commutative96.9%
associate-*l/97.4%
associate-/l*96.6%
div-inv96.5%
clear-num96.5%
Applied egg-rr96.5%
Final simplification95.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= z -130000.0) (/ (* (/ x z) (/ y z)) z) (if (<= z 0.76) (/ (* y (- (/ x z) x)) z) (/ (/ y z) (* z (/ z x))))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (z <= -130000.0) {
tmp = ((x / z) * (y / z)) / z;
} else if (z <= 0.76) {
tmp = (y * ((x / z) - x)) / z;
} else {
tmp = (y / z) / (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 <= (-130000.0d0)) then
tmp = ((x / z) * (y / z)) / z
else if (z <= 0.76d0) then
tmp = (y * ((x / z) - x)) / z
else
tmp = (y / z) / (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 <= -130000.0) {
tmp = ((x / z) * (y / z)) / z;
} else if (z <= 0.76) {
tmp = (y * ((x / z) - x)) / z;
} else {
tmp = (y / z) / (z * (z / x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if z <= -130000.0: tmp = ((x / z) * (y / z)) / z elif z <= 0.76: tmp = (y * ((x / z) - x)) / z else: tmp = (y / z) / (z * (z / x)) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (z <= -130000.0) tmp = Float64(Float64(Float64(x / z) * Float64(y / z)) / z); elseif (z <= 0.76) tmp = Float64(Float64(y * Float64(Float64(x / z) - x)) / z); else tmp = Float64(Float64(y / z) / 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 <= -130000.0)
tmp = ((x / z) * (y / z)) / z;
elseif (z <= 0.76)
tmp = (y * ((x / z) - x)) / z;
else
tmp = (y / z) / (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, -130000.0], N[(N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 0.76], N[(N[(y * N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(y / z), $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 -130000:\\
\;\;\;\;\frac{\frac{x}{z} \cdot \frac{y}{z}}{z}\\
\mathbf{elif}\;z \leq 0.76:\\
\;\;\;\;\frac{y \cdot \left(\frac{x}{z} - x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z}}{z \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if z < -1.3e5Initial program 79.4%
sqr-neg79.4%
times-frac93.0%
sqr-neg93.0%
Simplified93.0%
Taylor expanded in z around inf 91.8%
*-commutative91.8%
associate-/r*96.9%
associate-*r/97.3%
Applied egg-rr97.3%
if -1.3e5 < z < 0.76000000000000001Initial program 82.3%
associate-*r/79.4%
sqr-neg79.4%
*-commutative79.4%
distribute-rgt1-in79.4%
sqr-neg79.4%
fma-def79.4%
sqr-neg79.4%
cube-unmult79.4%
Simplified79.4%
associate-*r/82.3%
fma-udef82.3%
cube-mult82.3%
distribute-rgt1-in82.3%
*-commutative82.3%
frac-times79.2%
*-commutative79.2%
associate-/r*84.7%
associate-*r/94.5%
Applied egg-rr94.5%
Taylor expanded in z around 0 86.6%
mul-1-neg86.6%
distribute-lft-neg-out86.6%
+-commutative86.6%
*-commutative86.6%
associate-*r/91.6%
*-commutative91.6%
distribute-lft-out94.0%
Simplified94.0%
if 0.76000000000000001 < z Initial program 78.0%
frac-times92.9%
associate-*l/90.2%
times-frac98.1%
Applied egg-rr98.1%
Taylor expanded in z around inf 96.9%
*-commutative96.9%
associate-*l/97.4%
associate-/l*96.6%
div-inv96.5%
clear-num96.5%
Applied egg-rr96.5%
Final simplification95.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (or (<= y -1.45e-23) (not (<= y 2.4e-52))) (* y (/ x (* z z))) (* (/ x z) (/ y z))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.45e-23) || !(y <= 2.4e-52)) {
tmp = y * (x / (z * z));
} else {
tmp = (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 ((y <= (-1.45d-23)) .or. (.not. (y <= 2.4d-52))) then
tmp = y * (x / (z * z))
else
tmp = (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 ((y <= -1.45e-23) || !(y <= 2.4e-52)) {
tmp = y * (x / (z * z));
} else {
tmp = (x / z) * (y / z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (y <= -1.45e-23) or not (y <= 2.4e-52): tmp = y * (x / (z * z)) else: tmp = (x / z) * (y / z) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if ((y <= -1.45e-23) || !(y <= 2.4e-52)) tmp = Float64(y * Float64(x / Float64(z * z))); else tmp = Float64(Float64(x / 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 ((y <= -1.45e-23) || ~((y <= 2.4e-52)))
tmp = y * (x / (z * z));
else
tmp = (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[Or[LessEqual[y, -1.45e-23], N[Not[LessEqual[y, 2.4e-52]], $MachinePrecision]], N[(y * N[(x / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{-23} \lor \neg \left(y \leq 2.4 \cdot 10^{-52}\right):\\
\;\;\;\;y \cdot \frac{x}{z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < -1.4500000000000001e-23 or 2.4000000000000002e-52 < y Initial program 80.3%
sqr-neg80.3%
times-frac92.2%
sqr-neg92.2%
Simplified92.2%
Taylor expanded in z around 0 75.2%
if -1.4500000000000001e-23 < y < 2.4000000000000002e-52Initial program 80.5%
frac-times78.8%
associate-*l/82.2%
times-frac94.1%
Applied egg-rr94.1%
Taylor expanded in z around 0 86.6%
Final simplification80.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (* (/ x z) (/ (/ y (+ z 1.0)) z)))
assert(x < y);
double code(double x, double y, double z) {
return (x / z) * ((y / (z + 1.0)) / z);
}
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 = (x / z) * ((y / (z + 1.0d0)) / z)
end function
assert x < y;
public static double code(double x, double y, double z) {
return (x / z) * ((y / (z + 1.0)) / z);
}
[x, y] = sort([x, y]) def code(x, y, z): return (x / z) * ((y / (z + 1.0)) / z)
x, y = sort([x, y]) function code(x, y, z) return Float64(Float64(x / z) * Float64(Float64(y / Float64(z + 1.0)) / z)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = (x / z) * ((y / (z + 1.0)) / z);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(N[(x / z), $MachinePrecision] * N[(N[(y / N[(z + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{z} \cdot \frac{\frac{y}{z + 1}}{z}
\end{array}
Initial program 80.4%
frac-times86.4%
associate-*l/86.8%
times-frac95.4%
Applied egg-rr95.4%
Final simplification95.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y 3e-53) (* (/ x z) (/ y z)) (* y (/ (/ x z) z))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (y <= 3e-53) {
tmp = (x / z) * (y / z);
} else {
tmp = y * ((x / z) / 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 (y <= 3d-53) then
tmp = (x / z) * (y / z)
else
tmp = y * ((x / z) / z)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3e-53) {
tmp = (x / z) * (y / z);
} else {
tmp = y * ((x / z) / z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if y <= 3e-53: tmp = (x / z) * (y / z) else: tmp = y * ((x / z) / z) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (y <= 3e-53) tmp = Float64(Float64(x / z) * Float64(y / z)); else tmp = Float64(y * Float64(Float64(x / z) / z)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (y <= 3e-53)
tmp = (x / z) * (y / z);
else
tmp = y * ((x / z) / 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[y, 3e-53], N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3 \cdot 10^{-53}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\frac{x}{z}}{z}\\
\end{array}
\end{array}
if y < 3.0000000000000002e-53Initial program 82.6%
frac-times85.7%
associate-*l/87.7%
times-frac95.7%
Applied egg-rr95.7%
Taylor expanded in z around 0 78.7%
if 3.0000000000000002e-53 < y Initial program 75.1%
associate-*r/75.4%
sqr-neg75.4%
*-commutative75.4%
distribute-rgt1-in69.4%
sqr-neg69.4%
fma-def75.4%
sqr-neg75.4%
cube-unmult75.5%
Simplified75.5%
associate-*r/75.1%
fma-udef69.4%
cube-mult69.4%
distribute-rgt1-in75.1%
*-commutative75.1%
frac-times88.3%
*-commutative88.3%
associate-/r*98.4%
associate-*r/97.4%
Applied egg-rr97.4%
Taylor expanded in z around 0 63.2%
*-commutative63.2%
associate-*r/63.9%
Simplified63.9%
*-un-lft-identity63.9%
times-frac69.1%
/-rgt-identity69.1%
Applied egg-rr69.1%
Final simplification76.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= x -9.6e-60) (/ x (* z (/ z y))) (* y (/ (/ x z) z))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (x <= -9.6e-60) {
tmp = x / (z * (z / y));
} else {
tmp = y * ((x / z) / 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 (x <= (-9.6d-60)) then
tmp = x / (z * (z / y))
else
tmp = y * ((x / z) / z)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if (x <= -9.6e-60) {
tmp = x / (z * (z / y));
} else {
tmp = y * ((x / z) / z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if x <= -9.6e-60: tmp = x / (z * (z / y)) else: tmp = y * ((x / z) / z) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (x <= -9.6e-60) tmp = Float64(x / Float64(z * Float64(z / y))); else tmp = Float64(y * Float64(Float64(x / z) / z)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (x <= -9.6e-60)
tmp = x / (z * (z / y));
else
tmp = y * ((x / z) / 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[x, -9.6e-60], N[(x / N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.6 \cdot 10^{-60}:\\
\;\;\;\;\frac{x}{z \cdot \frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\frac{x}{z}}{z}\\
\end{array}
\end{array}
if x < -9.60000000000000038e-60Initial program 77.4%
frac-times83.8%
associate-*l/87.3%
times-frac93.9%
Applied egg-rr93.9%
Taylor expanded in z around 0 63.0%
associate-*l/66.3%
associate-/l*72.0%
div-inv72.0%
clear-num72.0%
Applied egg-rr72.0%
if -9.60000000000000038e-60 < x Initial program 81.8%
associate-*r/81.8%
sqr-neg81.8%
*-commutative81.8%
distribute-rgt1-in63.2%
sqr-neg63.2%
fma-def81.8%
sqr-neg81.8%
cube-unmult81.9%
Simplified81.9%
associate-*r/81.8%
fma-udef63.1%
cube-mult63.1%
distribute-rgt1-in81.8%
*-commutative81.8%
frac-times87.5%
*-commutative87.5%
associate-/r*92.4%
associate-*r/96.8%
Applied egg-rr96.8%
Taylor expanded in z around 0 72.9%
*-commutative72.9%
associate-*r/78.6%
Simplified78.6%
*-un-lft-identity78.6%
times-frac79.1%
/-rgt-identity79.1%
Applied egg-rr79.1%
Final simplification76.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= x -6.5e-60) (/ x (/ z (/ y z))) (* y (/ (/ x z) z))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (x <= -6.5e-60) {
tmp = x / (z / (y / z));
} else {
tmp = y * ((x / z) / 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 (x <= (-6.5d-60)) then
tmp = x / (z / (y / z))
else
tmp = y * ((x / z) / z)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double tmp;
if (x <= -6.5e-60) {
tmp = x / (z / (y / z));
} else {
tmp = y * ((x / z) / z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if x <= -6.5e-60: tmp = x / (z / (y / z)) else: tmp = y * ((x / z) / z) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (x <= -6.5e-60) tmp = Float64(x / Float64(z / Float64(y / z))); else tmp = Float64(y * Float64(Float64(x / z) / z)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (x <= -6.5e-60)
tmp = x / (z / (y / z));
else
tmp = y * ((x / z) / 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[x, -6.5e-60], N[(x / N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{-60}:\\
\;\;\;\;\frac{x}{\frac{z}{\frac{y}{z}}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\frac{x}{z}}{z}\\
\end{array}
\end{array}
if x < -6.49999999999999995e-60Initial program 77.4%
frac-times83.8%
associate-*l/87.3%
times-frac93.9%
Applied egg-rr93.9%
Taylor expanded in z around 0 63.0%
associate-*l/66.3%
associate-/l*72.0%
div-inv72.0%
clear-num72.0%
Applied egg-rr72.0%
clear-num72.0%
un-div-inv72.0%
Applied egg-rr72.0%
if -6.49999999999999995e-60 < x Initial program 81.8%
associate-*r/81.8%
sqr-neg81.8%
*-commutative81.8%
distribute-rgt1-in63.2%
sqr-neg63.2%
fma-def81.8%
sqr-neg81.8%
cube-unmult81.9%
Simplified81.9%
associate-*r/81.8%
fma-udef63.1%
cube-mult63.1%
distribute-rgt1-in81.8%
*-commutative81.8%
frac-times87.5%
*-commutative87.5%
associate-/r*92.4%
associate-*r/96.8%
Applied egg-rr96.8%
Taylor expanded in z around 0 72.9%
*-commutative72.9%
associate-*r/78.6%
Simplified78.6%
*-un-lft-identity78.6%
times-frac79.1%
/-rgt-identity79.1%
Applied egg-rr79.1%
Final simplification76.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= x -1.7e-60) (/ x (/ z (/ y z))) (/ y (* z (/ z x)))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (x <= -1.7e-60) {
tmp = x / (z / (y / z));
} else {
tmp = 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 (x <= (-1.7d-60)) then
tmp = x / (z / (y / z))
else
tmp = 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 (x <= -1.7e-60) {
tmp = x / (z / (y / z));
} else {
tmp = y / (z * (z / x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if x <= -1.7e-60: tmp = x / (z / (y / z)) else: tmp = y / (z * (z / x)) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (x <= -1.7e-60) tmp = Float64(x / Float64(z / Float64(y / z))); else tmp = Float64(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 (x <= -1.7e-60)
tmp = x / (z / (y / z));
else
tmp = 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[x, -1.7e-60], N[(x / N[(z / N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{-60}:\\
\;\;\;\;\frac{x}{\frac{z}{\frac{y}{z}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if x < -1.70000000000000003e-60Initial program 77.4%
frac-times83.8%
associate-*l/87.3%
times-frac93.9%
Applied egg-rr93.9%
Taylor expanded in z around 0 63.0%
associate-*l/66.3%
associate-/l*72.0%
div-inv72.0%
clear-num72.0%
Applied egg-rr72.0%
clear-num72.0%
un-div-inv72.0%
Applied egg-rr72.0%
if -1.70000000000000003e-60 < x Initial program 81.8%
frac-times87.5%
associate-*l/86.7%
times-frac96.2%
Applied egg-rr96.2%
Taylor expanded in z around 0 77.5%
*-commutative77.5%
associate-/r/80.6%
div-inv80.6%
clear-num80.6%
Applied egg-rr80.6%
Final simplification78.0%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (* y (/ (/ x z) z)))
assert(x < y);
double code(double x, double y, double z) {
return y * ((x / z) / z);
}
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 = y * ((x / z) / z)
end function
assert x < y;
public static double code(double x, double y, double z) {
return y * ((x / z) / z);
}
[x, y] = sort([x, y]) def code(x, y, z): return y * ((x / z) / z)
x, y = sort([x, y]) function code(x, y, z) return Float64(y * Float64(Float64(x / z) / z)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = y * ((x / z) / z);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(y * N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
y \cdot \frac{\frac{x}{z}}{z}
\end{array}
Initial program 80.4%
associate-*r/81.8%
sqr-neg81.8%
*-commutative81.8%
distribute-rgt1-in65.3%
sqr-neg65.3%
fma-def81.8%
sqr-neg81.8%
cube-unmult81.8%
Simplified81.8%
associate-*r/80.4%
fma-udef64.8%
cube-mult64.8%
distribute-rgt1-in80.4%
*-commutative80.4%
frac-times86.4%
*-commutative86.4%
associate-/r*91.6%
associate-*r/96.7%
Applied egg-rr96.7%
Taylor expanded in z around 0 70.3%
*-commutative70.3%
associate-*r/73.3%
Simplified73.3%
*-un-lft-identity73.3%
times-frac73.5%
/-rgt-identity73.5%
Applied egg-rr73.5%
Final simplification73.5%
(FPCore (x y z) :precision binary64 (if (< z 249.6182814532307) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1.0 z)) x) z)))
double code(double x, double y, double z) {
double tmp;
if (z < 249.6182814532307) {
tmp = (y * (x / z)) / (z + (z * z));
} else {
tmp = (((y / z) / (1.0 + z)) * x) / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z < 249.6182814532307d0) then
tmp = (y * (x / z)) / (z + (z * z))
else
tmp = (((y / z) / (1.0d0 + z)) * x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z < 249.6182814532307) {
tmp = (y * (x / z)) / (z + (z * z));
} else {
tmp = (((y / z) / (1.0 + z)) * x) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z < 249.6182814532307: tmp = (y * (x / z)) / (z + (z * z)) else: tmp = (((y / z) / (1.0 + z)) * x) / z return tmp
function code(x, y, z) tmp = 0.0 if (z < 249.6182814532307) tmp = Float64(Float64(y * Float64(x / z)) / Float64(z + Float64(z * z))); else tmp = Float64(Float64(Float64(Float64(y / z) / Float64(1.0 + z)) * x) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z < 249.6182814532307) tmp = (y * (x / z)) / (z + (z * z)); else tmp = (((y / z) / (1.0 + z)) * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Less[z, 249.6182814532307], N[(N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision] / N[(z + N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y / z), $MachinePrecision] / N[(1.0 + z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z < 249.6182814532307:\\
\;\;\;\;\frac{y \cdot \frac{x}{z}}{z + z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{y}{z}}{1 + z} \cdot x}{z}\\
\end{array}
\end{array}
herbie shell --seed 2023310
(FPCore (x y z)
:name "Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(if (< z 249.6182814532307) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1.0 z)) x) z))
(/ (* x y) (* (* z z) (+ z 1.0))))