
(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 9 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, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (* (/ y z) (/ (/ x z) (+ z 1.0))))
assert(x < y && y < z);
double code(double x, double y, double z) {
return (y / z) * ((x / z) / (z + 1.0));
}
NOTE: x, y, and z 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) * ((x / z) / (z + 1.0d0))
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
return (y / z) * ((x / z) / (z + 1.0));
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): return (y / z) * ((x / z) / (z + 1.0))
x, y, z = sort([x, y, z]) function code(x, y, z) return Float64(Float64(y / z) * Float64(Float64(x / z) / Float64(z + 1.0))) end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp = code(x, y, z)
tmp = (y / z) * ((x / z) / (z + 1.0));
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(N[(y / z), $MachinePrecision] * N[(N[(x / z), $MachinePrecision] / N[(z + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\frac{y}{z} \cdot \frac{\frac{x}{z}}{z + 1}
\end{array}
Initial program 85.0%
*-commutative85.0%
frac-times87.9%
associate-*l/87.3%
times-frac97.2%
Applied egg-rr97.2%
Taylor expanded in x around 0 95.6%
associate-/r*97.2%
+-commutative97.2%
Simplified97.2%
Final simplification97.2%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 4.2e-15))) (* (/ y z) (/ (/ x z) z)) (/ (* y (/ x z)) z)))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 4.2e-15)) {
tmp = (y / z) * ((x / z) / z);
} else {
tmp = (y * (x / z)) / z;
}
return tmp;
}
NOTE: x, y, and z 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 <= 4.2d-15))) then
tmp = (y / z) * ((x / z) / z)
else
tmp = (y * (x / z)) / z
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 4.2e-15)) {
tmp = (y / z) * ((x / z) / z);
} else {
tmp = (y * (x / z)) / z;
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 4.2e-15): tmp = (y / z) * ((x / z) / z) else: tmp = (y * (x / z)) / z return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 4.2e-15)) tmp = Float64(Float64(y / z) * Float64(Float64(x / z) / z)); else tmp = Float64(Float64(y * Float64(x / z)) / z); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z <= -1.0) || ~((z <= 4.2e-15)))
tmp = (y / z) * ((x / z) / z);
else
tmp = (y * (x / z)) / z;
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 4.2e-15]], $MachinePrecision]], N[(N[(y / z), $MachinePrecision] * N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 4.2 \cdot 10^{-15}\right):\\
\;\;\;\;\frac{y}{z} \cdot \frac{\frac{x}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \frac{x}{z}}{z}\\
\end{array}
\end{array}
if z < -1 or 4.19999999999999962e-15 < z Initial program 89.7%
*-commutative89.7%
frac-times95.8%
associate-*l/94.3%
times-frac98.3%
Applied egg-rr98.3%
Taylor expanded in z around inf 94.9%
if -1 < z < 4.19999999999999962e-15Initial program 80.7%
*-commutative80.7%
associate-*l/80.5%
*-commutative80.5%
sqr-neg80.5%
*-commutative80.5%
distribute-rgt1-in80.5%
sqr-neg80.5%
fma-def80.5%
sqr-neg80.5%
cube-unmult80.5%
Simplified80.5%
fma-def80.5%
associate-*r/80.7%
*-commutative80.7%
cube-mult80.7%
distribute-rgt1-in80.7%
*-commutative80.7%
frac-times80.5%
associate-/r*89.8%
associate-*l/96.4%
Applied egg-rr96.4%
Taylor expanded in z around 0 88.7%
associate-*l/94.1%
*-commutative94.1%
Simplified94.1%
Final simplification94.5%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 4.2e-15))) (/ (* (/ y z) (/ x z)) z) (/ (* y (- (/ x z) x)) z)))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 4.2e-15)) {
tmp = ((y / z) * (x / z)) / z;
} else {
tmp = (y * ((x / z) - x)) / z;
}
return tmp;
}
NOTE: x, y, and z 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 <= 4.2d-15))) then
tmp = ((y / z) * (x / z)) / z
else
tmp = (y * ((x / z) - x)) / z
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 4.2e-15)) {
tmp = ((y / z) * (x / z)) / z;
} else {
tmp = (y * ((x / z) - x)) / z;
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 4.2e-15): tmp = ((y / z) * (x / z)) / z else: tmp = (y * ((x / z) - x)) / z return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 4.2e-15)) tmp = Float64(Float64(Float64(y / z) * Float64(x / z)) / z); else tmp = Float64(Float64(y * Float64(Float64(x / z) - x)) / z); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z <= -1.0) || ~((z <= 4.2e-15)))
tmp = ((y / z) * (x / z)) / z;
else
tmp = (y * ((x / z) - x)) / z;
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 4.2e-15]], $MachinePrecision]], N[(N[(N[(y / z), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(y * N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 4.2 \cdot 10^{-15}\right):\\
\;\;\;\;\frac{\frac{y}{z} \cdot \frac{x}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(\frac{x}{z} - x\right)}{z}\\
\end{array}
\end{array}
if z < -1 or 4.19999999999999962e-15 < z Initial program 89.7%
*-commutative89.7%
associate-*l/95.5%
*-commutative95.5%
sqr-neg95.5%
*-commutative95.5%
distribute-rgt1-in71.2%
sqr-neg71.2%
fma-def95.5%
sqr-neg95.5%
cube-unmult95.5%
Simplified95.5%
fma-def71.2%
associate-*r/67.0%
*-commutative67.0%
cube-mult67.0%
distribute-rgt1-in89.7%
*-commutative89.7%
frac-times95.8%
associate-/r*99.1%
associate-*l/98.4%
Applied egg-rr98.4%
Taylor expanded in z around inf 95.0%
if -1 < z < 4.19999999999999962e-15Initial program 80.7%
*-commutative80.7%
associate-*l/80.5%
*-commutative80.5%
sqr-neg80.5%
*-commutative80.5%
distribute-rgt1-in80.5%
sqr-neg80.5%
fma-def80.5%
sqr-neg80.5%
cube-unmult80.5%
Simplified80.5%
fma-def80.5%
associate-*r/80.7%
*-commutative80.7%
cube-mult80.7%
distribute-rgt1-in80.7%
*-commutative80.7%
frac-times80.5%
associate-/r*89.8%
associate-*l/96.4%
Applied egg-rr96.4%
Taylor expanded in z around 0 85.5%
mul-1-neg85.5%
distribute-lft-neg-out85.5%
associate-*l/91.0%
distribute-rgt-out94.8%
+-commutative94.8%
unsub-neg94.8%
Simplified94.8%
Final simplification94.9%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= z -1.0) (* (/ x z) (/ y (* z z))) (if (<= z 4.2e-15) (/ (* y (/ x z)) z) (* (/ y z) (/ (/ x z) z)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = (x / z) * (y / (z * z));
} else if (z <= 4.2e-15) {
tmp = (y * (x / z)) / z;
} else {
tmp = (y / z) * ((x / z) / z);
}
return tmp;
}
NOTE: x, y, and z 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 = (x / z) * (y / (z * z))
else if (z <= 4.2d-15) then
tmp = (y * (x / z)) / z
else
tmp = (y / z) * ((x / z) / z)
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = (x / z) * (y / (z * z));
} else if (z <= 4.2e-15) {
tmp = (y * (x / z)) / z;
} else {
tmp = (y / z) * ((x / z) / z);
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if z <= -1.0: tmp = (x / z) * (y / (z * z)) elif z <= 4.2e-15: tmp = (y * (x / z)) / z else: tmp = (y / z) * ((x / z) / z) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(Float64(x / z) * Float64(y / Float64(z * z))); elseif (z <= 4.2e-15) tmp = Float64(Float64(y * Float64(x / z)) / z); else tmp = Float64(Float64(y / z) * Float64(Float64(x / z) / z)); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (z <= -1.0)
tmp = (x / z) * (y / (z * z));
elseif (z <= 4.2e-15)
tmp = (y * (x / z)) / z;
else
tmp = (y / z) * ((x / z) / z);
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(N[(x / z), $MachinePrecision] * N[(y / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.2e-15], N[(N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;\frac{x}{z} \cdot \frac{y}{z \cdot z}\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-15}:\\
\;\;\;\;\frac{y \cdot \frac{x}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot \frac{\frac{x}{z}}{z}\\
\end{array}
\end{array}
if z < -1Initial program 92.8%
sqr-neg92.8%
*-commutative92.8%
times-frac98.1%
sqr-neg98.1%
Simplified98.1%
Taylor expanded in z around inf 96.7%
if -1 < z < 4.19999999999999962e-15Initial program 80.7%
*-commutative80.7%
associate-*l/80.5%
*-commutative80.5%
sqr-neg80.5%
*-commutative80.5%
distribute-rgt1-in80.5%
sqr-neg80.5%
fma-def80.5%
sqr-neg80.5%
cube-unmult80.5%
Simplified80.5%
fma-def80.5%
associate-*r/80.7%
*-commutative80.7%
cube-mult80.7%
distribute-rgt1-in80.7%
*-commutative80.7%
frac-times80.5%
associate-/r*89.8%
associate-*l/96.4%
Applied egg-rr96.4%
Taylor expanded in z around 0 88.7%
associate-*l/94.1%
*-commutative94.1%
Simplified94.1%
if 4.19999999999999962e-15 < z Initial program 87.2%
*-commutative87.2%
frac-times93.9%
associate-*l/92.6%
times-frac98.4%
Applied egg-rr98.4%
Taylor expanded in z around inf 93.5%
Final simplification94.5%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= z -1.0) (* (/ x z) (/ y (* z z))) (if (<= z 4.2e-15) (/ (* y (- (/ x z) x)) z) (* (/ y z) (/ (/ x z) z)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = (x / z) * (y / (z * z));
} else if (z <= 4.2e-15) {
tmp = (y * ((x / z) - x)) / z;
} else {
tmp = (y / z) * ((x / z) / z);
}
return tmp;
}
NOTE: x, y, and z 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 = (x / z) * (y / (z * z))
else if (z <= 4.2d-15) then
tmp = (y * ((x / z) - x)) / z
else
tmp = (y / z) * ((x / z) / z)
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = (x / z) * (y / (z * z));
} else if (z <= 4.2e-15) {
tmp = (y * ((x / z) - x)) / z;
} else {
tmp = (y / z) * ((x / z) / z);
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if z <= -1.0: tmp = (x / z) * (y / (z * z)) elif z <= 4.2e-15: tmp = (y * ((x / z) - x)) / z else: tmp = (y / z) * ((x / z) / z) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(Float64(x / z) * Float64(y / Float64(z * z))); elseif (z <= 4.2e-15) tmp = Float64(Float64(y * Float64(Float64(x / z) - x)) / z); else tmp = Float64(Float64(y / z) * Float64(Float64(x / z) / z)); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (z <= -1.0)
tmp = (x / z) * (y / (z * z));
elseif (z <= 4.2e-15)
tmp = (y * ((x / z) - x)) / z;
else
tmp = (y / z) * ((x / z) / z);
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(N[(x / z), $MachinePrecision] * N[(y / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.2e-15], N[(N[(y * N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * N[(N[(x / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;\frac{x}{z} \cdot \frac{y}{z \cdot z}\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-15}:\\
\;\;\;\;\frac{y \cdot \left(\frac{x}{z} - x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot \frac{\frac{x}{z}}{z}\\
\end{array}
\end{array}
if z < -1Initial program 92.8%
sqr-neg92.8%
*-commutative92.8%
times-frac98.1%
sqr-neg98.1%
Simplified98.1%
Taylor expanded in z around inf 96.7%
if -1 < z < 4.19999999999999962e-15Initial program 80.7%
*-commutative80.7%
associate-*l/80.5%
*-commutative80.5%
sqr-neg80.5%
*-commutative80.5%
distribute-rgt1-in80.5%
sqr-neg80.5%
fma-def80.5%
sqr-neg80.5%
cube-unmult80.5%
Simplified80.5%
fma-def80.5%
associate-*r/80.7%
*-commutative80.7%
cube-mult80.7%
distribute-rgt1-in80.7%
*-commutative80.7%
frac-times80.5%
associate-/r*89.8%
associate-*l/96.4%
Applied egg-rr96.4%
Taylor expanded in z around 0 85.5%
mul-1-neg85.5%
distribute-lft-neg-out85.5%
associate-*l/91.0%
distribute-rgt-out94.8%
+-commutative94.8%
unsub-neg94.8%
Simplified94.8%
if 4.19999999999999962e-15 < z Initial program 87.2%
*-commutative87.2%
frac-times93.9%
associate-*l/92.6%
times-frac98.4%
Applied egg-rr98.4%
Taylor expanded in z around inf 93.5%
Final simplification94.8%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= z -1.0) (/ (/ (* y (/ x z)) z) z) (if (<= z 4.2e-15) (/ (* y (- (/ x z) x)) z) (/ (* (/ y z) (/ x z)) z))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = ((y * (x / z)) / z) / z;
} else if (z <= 4.2e-15) {
tmp = (y * ((x / z) - x)) / z;
} else {
tmp = ((y / z) * (x / z)) / z;
}
return tmp;
}
NOTE: x, y, and z 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 = ((y * (x / z)) / z) / z
else if (z <= 4.2d-15) then
tmp = (y * ((x / z) - x)) / z
else
tmp = ((y / z) * (x / z)) / z
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = ((y * (x / z)) / z) / z;
} else if (z <= 4.2e-15) {
tmp = (y * ((x / z) - x)) / z;
} else {
tmp = ((y / z) * (x / z)) / z;
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if z <= -1.0: tmp = ((y * (x / z)) / z) / z elif z <= 4.2e-15: tmp = (y * ((x / z) - x)) / z else: tmp = ((y / z) * (x / z)) / z return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(Float64(Float64(y * Float64(x / z)) / z) / z); elseif (z <= 4.2e-15) tmp = Float64(Float64(y * Float64(Float64(x / z) - x)) / z); else tmp = Float64(Float64(Float64(y / z) * Float64(x / z)) / z); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (z <= -1.0)
tmp = ((y * (x / z)) / z) / z;
elseif (z <= 4.2e-15)
tmp = (y * ((x / z) - x)) / z;
else
tmp = ((y / z) * (x / z)) / z;
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[z, -1.0], N[(N[(N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 4.2e-15], N[(N[(y * N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(y / z), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;\frac{\frac{y \cdot \frac{x}{z}}{z}}{z}\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-15}:\\
\;\;\;\;\frac{y \cdot \left(\frac{x}{z} - x\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z} \cdot \frac{x}{z}}{z}\\
\end{array}
\end{array}
if z < -1Initial program 92.8%
*-commutative92.8%
associate-*l/98.1%
*-commutative98.1%
sqr-neg98.1%
*-commutative98.1%
distribute-rgt1-in42.5%
sqr-neg42.5%
fma-def98.2%
sqr-neg98.2%
cube-unmult98.2%
Simplified98.2%
fma-def42.5%
associate-*r/40.8%
*-commutative40.8%
cube-mult40.8%
distribute-rgt1-in92.8%
*-commutative92.8%
frac-times98.1%
associate-*l/96.4%
associate-/r*98.2%
Applied egg-rr98.2%
Taylor expanded in z around inf 96.8%
if -1 < z < 4.19999999999999962e-15Initial program 80.7%
*-commutative80.7%
associate-*l/80.5%
*-commutative80.5%
sqr-neg80.5%
*-commutative80.5%
distribute-rgt1-in80.5%
sqr-neg80.5%
fma-def80.5%
sqr-neg80.5%
cube-unmult80.5%
Simplified80.5%
fma-def80.5%
associate-*r/80.7%
*-commutative80.7%
cube-mult80.7%
distribute-rgt1-in80.7%
*-commutative80.7%
frac-times80.5%
associate-/r*89.8%
associate-*l/96.4%
Applied egg-rr96.4%
Taylor expanded in z around 0 85.5%
mul-1-neg85.5%
distribute-lft-neg-out85.5%
associate-*l/91.0%
distribute-rgt-out94.8%
+-commutative94.8%
unsub-neg94.8%
Simplified94.8%
if 4.19999999999999962e-15 < z Initial program 87.2%
*-commutative87.2%
associate-*l/93.4%
*-commutative93.4%
sqr-neg93.4%
*-commutative93.4%
distribute-rgt1-in93.4%
sqr-neg93.4%
fma-def93.4%
sqr-neg93.4%
cube-unmult93.4%
Simplified93.4%
fma-def93.4%
associate-*r/87.2%
*-commutative87.2%
cube-mult87.2%
distribute-rgt1-in87.2%
*-commutative87.2%
frac-times93.9%
associate-/r*98.5%
associate-*l/98.5%
Applied egg-rr98.5%
Taylor expanded in z around inf 93.6%
Final simplification94.9%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= x 1.4e-138) (* (/ y z) (/ x z)) (* x (/ y (* z z)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (x <= 1.4e-138) {
tmp = (y / z) * (x / z);
} else {
tmp = x * (y / (z * z));
}
return tmp;
}
NOTE: x, y, and z 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.4d-138) then
tmp = (y / z) * (x / z)
else
tmp = x * (y / (z * z))
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1.4e-138) {
tmp = (y / z) * (x / z);
} else {
tmp = x * (y / (z * z));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if x <= 1.4e-138: tmp = (y / z) * (x / z) else: tmp = x * (y / (z * z)) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (x <= 1.4e-138) tmp = Float64(Float64(y / z) * Float64(x / z)); else tmp = Float64(x * Float64(y / Float64(z * z))); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (x <= 1.4e-138)
tmp = (y / z) * (x / z);
else
tmp = x * (y / (z * z));
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[x, 1.4e-138], N[(N[(y / z), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.4 \cdot 10^{-138}:\\
\;\;\;\;\frac{y}{z} \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z \cdot z}\\
\end{array}
\end{array}
if x < 1.4e-138Initial program 82.8%
*-commutative82.8%
frac-times85.4%
associate-*l/84.5%
times-frac97.5%
Applied egg-rr97.5%
Taylor expanded in z around 0 81.3%
if 1.4e-138 < x Initial program 89.1%
sqr-neg89.1%
*-commutative89.1%
times-frac92.6%
sqr-neg92.6%
Simplified92.6%
Taylor expanded in z around 0 79.3%
Final simplification80.6%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y 1e-40) (* (/ y z) (/ x z)) (/ y (* z (/ z x)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= 1e-40) {
tmp = (y / z) * (x / z);
} else {
tmp = y / (z * (z / x));
}
return tmp;
}
NOTE: x, y, and z 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 <= 1d-40) then
tmp = (y / z) * (x / z)
else
tmp = y / (z * (z / x))
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1e-40) {
tmp = (y / z) * (x / z);
} else {
tmp = y / (z * (z / x));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if y <= 1e-40: tmp = (y / z) * (x / z) else: tmp = y / (z * (z / x)) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= 1e-40) tmp = Float64(Float64(y / z) * Float64(x / z)); else tmp = Float64(y / Float64(z * Float64(z / x))); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (y <= 1e-40)
tmp = (y / z) * (x / z);
else
tmp = y / (z * (z / x));
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, 1e-40], N[(N[(y / z), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 10^{-40}:\\
\;\;\;\;\frac{y}{z} \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if y < 9.9999999999999993e-41Initial program 85.5%
*-commutative85.5%
frac-times87.3%
associate-*l/86.5%
times-frac97.4%
Applied egg-rr97.4%
Taylor expanded in z around 0 84.2%
if 9.9999999999999993e-41 < y Initial program 83.5%
*-commutative83.5%
frac-times89.8%
associate-*l/89.8%
times-frac96.7%
Applied egg-rr96.7%
Taylor expanded in z around 0 59.9%
associate-/r/66.5%
div-inv66.5%
clear-num66.5%
Applied egg-rr66.5%
Final simplification80.0%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (* (/ y z) (/ x z)))
assert(x < y && y < z);
double code(double x, double y, double z) {
return (y / z) * (x / z);
}
NOTE: x, y, and z 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) * (x / z)
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
return (y / z) * (x / z);
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): return (y / z) * (x / z)
x, y, z = sort([x, y, z]) function code(x, y, z) return Float64(Float64(y / z) * Float64(x / z)) end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp = code(x, y, z)
tmp = (y / z) * (x / z);
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(N[(y / z), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\frac{y}{z} \cdot \frac{x}{z}
\end{array}
Initial program 85.0%
*-commutative85.0%
frac-times87.9%
associate-*l/87.3%
times-frac97.2%
Applied egg-rr97.2%
Taylor expanded in z around 0 78.5%
Final simplification78.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 2024021
(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))))