
(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 11 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
(let* ((t_0 (* (+ z 1.0) (* z z))) (t_1 (/ (/ y z) (* z (/ z x)))))
(if (<= t_0 -40000000000.0)
t_1
(if (<= t_0 5e-192)
(/ (* (/ x z) y) z)
(if (<= t_0 5e+240) (/ (* x y) t_0) t_1)))))assert(x < y);
double code(double x, double y, double z) {
double t_0 = (z + 1.0) * (z * z);
double t_1 = (y / z) / (z * (z / x));
double tmp;
if (t_0 <= -40000000000.0) {
tmp = t_1;
} else if (t_0 <= 5e-192) {
tmp = ((x / z) * y) / z;
} else if (t_0 <= 5e+240) {
tmp = (x * y) / t_0;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = (z + 1.0d0) * (z * z)
t_1 = (y / z) / (z * (z / x))
if (t_0 <= (-40000000000.0d0)) then
tmp = t_1
else if (t_0 <= 5d-192) then
tmp = ((x / z) * y) / z
else if (t_0 <= 5d+240) then
tmp = (x * y) / t_0
else
tmp = t_1
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z) {
double t_0 = (z + 1.0) * (z * z);
double t_1 = (y / z) / (z * (z / x));
double tmp;
if (t_0 <= -40000000000.0) {
tmp = t_1;
} else if (t_0 <= 5e-192) {
tmp = ((x / z) * y) / z;
} else if (t_0 <= 5e+240) {
tmp = (x * y) / t_0;
} else {
tmp = t_1;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): t_0 = (z + 1.0) * (z * z) t_1 = (y / z) / (z * (z / x)) tmp = 0 if t_0 <= -40000000000.0: tmp = t_1 elif t_0 <= 5e-192: tmp = ((x / z) * y) / z elif t_0 <= 5e+240: tmp = (x * y) / t_0 else: tmp = t_1 return tmp
x, y = sort([x, y]) function code(x, y, z) t_0 = Float64(Float64(z + 1.0) * Float64(z * z)) t_1 = Float64(Float64(y / z) / Float64(z * Float64(z / x))) tmp = 0.0 if (t_0 <= -40000000000.0) tmp = t_1; elseif (t_0 <= 5e-192) tmp = Float64(Float64(Float64(x / z) * y) / z); elseif (t_0 <= 5e+240) tmp = Float64(Float64(x * y) / t_0); else tmp = t_1; end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z)
t_0 = (z + 1.0) * (z * z);
t_1 = (y / z) / (z * (z / x));
tmp = 0.0;
if (t_0 <= -40000000000.0)
tmp = t_1;
elseif (t_0 <= 5e-192)
tmp = ((x / z) * y) / z;
elseif (t_0 <= 5e+240)
tmp = (x * y) / t_0;
else
tmp = t_1;
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[(N[(z + 1.0), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -40000000000.0], t$95$1, If[LessEqual[t$95$0, 5e-192], N[(N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$0, 5e+240], N[(N[(x * y), $MachinePrecision] / t$95$0), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \left(z + 1\right) \cdot \left(z \cdot z\right)\\
t_1 := \frac{\frac{y}{z}}{z \cdot \frac{z}{x}}\\
\mathbf{if}\;t_0 \leq -40000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{-192}:\\
\;\;\;\;\frac{\frac{x}{z} \cdot y}{z}\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+240}:\\
\;\;\;\;\frac{x \cdot y}{t_0}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 z z) (+.f64 z 1)) < -4e10 or 5.0000000000000003e240 < (*.f64 (*.f64 z z) (+.f64 z 1)) Initial program 82.2%
associate-*l*82.2%
times-frac93.5%
distribute-lft-in93.5%
fma-def93.5%
*-rgt-identity93.5%
Simplified93.5%
Taylor expanded in z around inf 92.3%
unpow292.3%
associate-/r*96.4%
Simplified96.4%
clear-num96.5%
frac-times98.6%
*-un-lft-identity98.6%
*-commutative98.6%
Applied egg-rr98.6%
if -4e10 < (*.f64 (*.f64 z z) (+.f64 z 1)) < 5.0000000000000001e-192Initial program 78.8%
associate-*l*78.8%
times-frac95.9%
distribute-lft-in95.9%
fma-def95.9%
*-rgt-identity95.9%
Simplified95.9%
Taylor expanded in z around 0 95.9%
associate-*r/95.9%
Applied egg-rr95.9%
if 5.0000000000000001e-192 < (*.f64 (*.f64 z z) (+.f64 z 1)) < 5.0000000000000003e240Initial program 97.9%
Final simplification97.5%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 8.5e-5))) (* (/ x z) (/ (/ y z) z)) (/ (* (/ x z) y) z)))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 8.5e-5)) {
tmp = (x / z) * ((y / 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 ((z <= (-1.0d0)) .or. (.not. (z <= 8.5d-5))) then
tmp = (x / z) * ((y / 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 ((z <= -1.0) || !(z <= 8.5e-5)) {
tmp = (x / z) * ((y / z) / z);
} else {
tmp = ((x / z) * y) / z;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 8.5e-5): tmp = (x / z) * ((y / z) / z) else: tmp = ((x / z) * y) / z return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 8.5e-5)) tmp = Float64(Float64(x / z) * Float64(Float64(y / z) / z)); else tmp = Float64(Float64(Float64(x / z) * 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) || ~((z <= 8.5e-5)))
tmp = (x / z) * ((y / 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[z, -1.0], N[Not[LessEqual[z, 8.5e-5]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * N[(N[(y / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 8.5 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z} \cdot y}{z}\\
\end{array}
\end{array}
if z < -1 or 8.500000000000001e-5 < z Initial program 84.1%
associate-*l*84.1%
times-frac92.7%
distribute-lft-in92.7%
fma-def92.7%
*-rgt-identity92.7%
Simplified92.7%
Taylor expanded in z around inf 91.3%
unpow291.3%
associate-/r*95.0%
Simplified95.0%
if -1 < z < 8.500000000000001e-5Initial program 84.2%
associate-*l*84.1%
times-frac94.9%
distribute-lft-in94.9%
fma-def94.9%
*-rgt-identity94.9%
Simplified94.9%
Taylor expanded in z around 0 92.6%
associate-*r/92.6%
Applied egg-rr92.6%
Final simplification93.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 8.5e-5))) (* (/ x z) (/ (/ y z) z)) (/ (- (/ y z) y) (/ z x))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 8.5e-5)) {
tmp = (x / z) * ((y / z) / z);
} else {
tmp = ((y / 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)) .or. (.not. (z <= 8.5d-5))) then
tmp = (x / z) * ((y / z) / z)
else
tmp = ((y / 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) || !(z <= 8.5e-5)) {
tmp = (x / z) * ((y / z) / z);
} else {
tmp = ((y / z) - y) / (z / x);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 8.5e-5): tmp = (x / z) * ((y / z) / z) else: tmp = ((y / z) - y) / (z / x) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 8.5e-5)) tmp = Float64(Float64(x / z) * Float64(Float64(y / z) / z)); else tmp = Float64(Float64(Float64(y / 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) || ~((z <= 8.5e-5)))
tmp = (x / z) * ((y / z) / z);
else
tmp = ((y / 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[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 8.5e-5]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * N[(N[(y / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / z), $MachinePrecision] - y), $MachinePrecision] / N[(z / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 8.5 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{z} - y}{\frac{z}{x}}\\
\end{array}
\end{array}
if z < -1 or 8.500000000000001e-5 < z Initial program 84.1%
associate-*l*84.1%
times-frac92.7%
distribute-lft-in92.7%
fma-def92.7%
*-rgt-identity92.7%
Simplified92.7%
Taylor expanded in z around inf 91.3%
unpow291.3%
associate-/r*95.0%
Simplified95.0%
if -1 < z < 8.500000000000001e-5Initial program 84.2%
associate-*l*84.1%
times-frac94.9%
distribute-lft-in94.9%
fma-def94.9%
*-rgt-identity94.9%
Simplified94.9%
Taylor expanded in z around 0 94.1%
neg-mul-194.1%
+-commutative94.1%
unsub-neg94.1%
Simplified94.1%
*-commutative94.1%
clear-num94.0%
un-div-inv94.8%
Applied egg-rr94.8%
Final simplification94.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= z -1.0) (/ (/ x z) (* z (/ z y))) (if (<= z 8.5e-5) (/ (- (/ y z) y) (/ z x)) (* (/ x z) (/ (/ y z) z)))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = (x / z) / (z * (z / y));
} else if (z <= 8.5e-5) {
tmp = ((y / z) - y) / (z / x);
} else {
tmp = (x / z) * ((y / 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 <= (-1.0d0)) then
tmp = (x / z) / (z * (z / y))
else if (z <= 8.5d-5) then
tmp = ((y / z) - y) / (z / x)
else
tmp = (x / z) * ((y / 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 <= -1.0) {
tmp = (x / z) / (z * (z / y));
} else if (z <= 8.5e-5) {
tmp = ((y / z) - y) / (z / x);
} else {
tmp = (x / z) * ((y / z) / z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if z <= -1.0: tmp = (x / z) / (z * (z / y)) elif z <= 8.5e-5: tmp = ((y / z) - y) / (z / x) else: tmp = (x / z) * ((y / z) / z) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(Float64(x / z) / Float64(z * Float64(z / y))); elseif (z <= 8.5e-5) tmp = Float64(Float64(Float64(y / z) - y) / Float64(z / x)); else tmp = Float64(Float64(x / z) * Float64(Float64(y / z) / 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 = (x / z) / (z * (z / y));
elseif (z <= 8.5e-5)
tmp = ((y / z) - y) / (z / x);
else
tmp = (x / z) * ((y / 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[z, -1.0], N[(N[(x / z), $MachinePrecision] / N[(z * N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.5e-5], N[(N[(N[(y / z), $MachinePrecision] - y), $MachinePrecision] / N[(z / x), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(N[(y / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;\frac{\frac{x}{z}}{z \cdot \frac{z}{y}}\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{y}{z} - y}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z}\\
\end{array}
\end{array}
if z < -1Initial program 79.3%
associate-*l*79.3%
times-frac93.4%
distribute-lft-in93.4%
fma-def93.4%
*-rgt-identity93.4%
Simplified93.4%
Taylor expanded in z around inf 91.5%
unpow291.5%
associate-/r*95.3%
Simplified95.3%
clear-num95.3%
un-div-inv95.4%
div-inv95.4%
clear-num95.4%
Applied egg-rr95.4%
if -1 < z < 8.500000000000001e-5Initial program 84.2%
associate-*l*84.1%
times-frac94.9%
distribute-lft-in94.9%
fma-def94.9%
*-rgt-identity94.9%
Simplified94.9%
Taylor expanded in z around 0 94.1%
neg-mul-194.1%
+-commutative94.1%
unsub-neg94.1%
Simplified94.1%
*-commutative94.1%
clear-num94.0%
un-div-inv94.8%
Applied egg-rr94.8%
if 8.500000000000001e-5 < z Initial program 90.6%
associate-*l*90.6%
times-frac91.8%
distribute-lft-in91.8%
fma-def91.8%
*-rgt-identity91.8%
Simplified91.8%
Taylor expanded in z around inf 91.1%
unpow291.1%
associate-/r*94.6%
Simplified94.6%
Final simplification94.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= z -1.0) (/ (/ y z) (* z (/ z x))) (if (<= z 8.5e-5) (/ (- (/ y z) y) (/ z x)) (* (/ x z) (/ (/ y z) z)))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = (y / z) / (z * (z / x));
} else if (z <= 8.5e-5) {
tmp = ((y / z) - y) / (z / x);
} else {
tmp = (x / z) * ((y / 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 <= (-1.0d0)) then
tmp = (y / z) / (z * (z / x))
else if (z <= 8.5d-5) then
tmp = ((y / z) - y) / (z / x)
else
tmp = (x / z) * ((y / 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 <= -1.0) {
tmp = (y / z) / (z * (z / x));
} else if (z <= 8.5e-5) {
tmp = ((y / z) - y) / (z / x);
} else {
tmp = (x / z) * ((y / z) / z);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if z <= -1.0: tmp = (y / z) / (z * (z / x)) elif z <= 8.5e-5: tmp = ((y / z) - y) / (z / x) else: tmp = (x / z) * ((y / z) / z) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(Float64(y / z) / Float64(z * Float64(z / x))); elseif (z <= 8.5e-5) tmp = Float64(Float64(Float64(y / z) - y) / Float64(z / x)); else tmp = Float64(Float64(x / z) * Float64(Float64(y / z) / 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 = (y / z) / (z * (z / x));
elseif (z <= 8.5e-5)
tmp = ((y / z) - y) / (z / x);
else
tmp = (x / z) * ((y / 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[z, -1.0], N[(N[(y / z), $MachinePrecision] / N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.5e-5], N[(N[(N[(y / z), $MachinePrecision] - y), $MachinePrecision] / N[(z / x), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(N[(y / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;\frac{\frac{y}{z}}{z \cdot \frac{z}{x}}\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{y}{z} - y}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z}\\
\end{array}
\end{array}
if z < -1Initial program 79.3%
associate-*l*79.3%
times-frac93.4%
distribute-lft-in93.4%
fma-def93.4%
*-rgt-identity93.4%
Simplified93.4%
Taylor expanded in z around inf 91.5%
unpow291.5%
associate-/r*95.3%
Simplified95.3%
clear-num95.3%
frac-times97.9%
*-un-lft-identity97.9%
*-commutative97.9%
Applied egg-rr97.9%
if -1 < z < 8.500000000000001e-5Initial program 84.2%
associate-*l*84.1%
times-frac94.9%
distribute-lft-in94.9%
fma-def94.9%
*-rgt-identity94.9%
Simplified94.9%
Taylor expanded in z around 0 94.1%
neg-mul-194.1%
+-commutative94.1%
unsub-neg94.1%
Simplified94.1%
*-commutative94.1%
clear-num94.0%
un-div-inv94.8%
Applied egg-rr94.8%
if 8.500000000000001e-5 < z Initial program 90.6%
associate-*l*90.6%
times-frac91.8%
distribute-lft-in91.8%
fma-def91.8%
*-rgt-identity91.8%
Simplified91.8%
Taylor expanded in z around inf 91.1%
unpow291.1%
associate-/r*94.6%
Simplified94.6%
Final simplification95.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (or (<= z -1.15e+147) (not (<= z 1.45e+86))) (* y (/ x (* z z))) (* (/ x z) (/ y z))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.15e+147) || !(z <= 1.45e+86)) {
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 ((z <= (-1.15d+147)) .or. (.not. (z <= 1.45d+86))) 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 ((z <= -1.15e+147) || !(z <= 1.45e+86)) {
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 (z <= -1.15e+147) or not (z <= 1.45e+86): 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 ((z <= -1.15e+147) || !(z <= 1.45e+86)) 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 ((z <= -1.15e+147) || ~((z <= 1.45e+86)))
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[z, -1.15e+147], N[Not[LessEqual[z, 1.45e+86]], $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}\;z \leq -1.15 \cdot 10^{+147} \lor \neg \left(z \leq 1.45 \cdot 10^{+86}\right):\\
\;\;\;\;y \cdot \frac{x}{z \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{y}{z}\\
\end{array}
\end{array}
if z < -1.15e147 or 1.44999999999999995e86 < z Initial program 84.5%
times-frac92.9%
Simplified92.9%
Taylor expanded in z around 0 88.3%
if -1.15e147 < z < 1.44999999999999995e86Initial program 84.0%
associate-*l*83.9%
times-frac94.4%
distribute-lft-in94.4%
fma-def94.4%
*-rgt-identity94.4%
Simplified94.4%
Taylor expanded in z around 0 77.3%
Final simplification80.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (/ (* (/ x z) (/ y z)) (+ z 1.0)))
assert(x < y);
double code(double x, double y, double z) {
return ((x / z) * (y / z)) / (z + 1.0);
}
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)) / (z + 1.0d0)
end function
assert x < y;
public static double code(double x, double y, double z) {
return ((x / z) * (y / z)) / (z + 1.0);
}
[x, y] = sort([x, y]) def code(x, y, z): return ((x / z) * (y / z)) / (z + 1.0)
x, y = sort([x, y]) function code(x, y, z) return Float64(Float64(Float64(x / z) * Float64(y / z)) / Float64(z + 1.0)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = ((x / z) * (y / z)) / (z + 1.0);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(N[(N[(x / z), $MachinePrecision] * N[(y / z), $MachinePrecision]), $MachinePrecision] / N[(z + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{x}{z} \cdot \frac{y}{z}}{z + 1}
\end{array}
Initial program 84.1%
associate-*l*84.1%
times-frac93.8%
distribute-lft-in93.8%
fma-def93.8%
*-rgt-identity93.8%
Simplified93.8%
fma-udef93.8%
*-rgt-identity93.8%
distribute-lft-in93.8%
times-frac84.1%
associate-*l*84.1%
associate-/r*85.8%
times-frac96.9%
Applied egg-rr96.9%
Final simplification96.9%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= x -9e-36) (/ x (* z (/ z y))) (* y (/ (/ x z) z))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (x <= -9e-36) {
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 <= (-9d-36)) 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 <= -9e-36) {
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 <= -9e-36: 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 <= -9e-36) 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 <= -9e-36)
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, -9e-36], 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 \cdot 10^{-36}:\\
\;\;\;\;\frac{x}{z \cdot \frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\frac{x}{z}}{z}\\
\end{array}
\end{array}
if x < -9.00000000000000047e-36Initial program 75.4%
/-rgt-identity75.4%
associate-/l*75.4%
associate-/l/79.2%
associate-*l*84.1%
associate-*r/84.1%
*-rgt-identity84.1%
associate-*l*91.1%
associate-*r/91.0%
distribute-lft-in91.0%
fma-def91.1%
*-rgt-identity91.1%
Simplified91.1%
Taylor expanded in z around 0 75.2%
if -9.00000000000000047e-36 < x Initial program 87.9%
associate-*l*87.9%
times-frac96.7%
distribute-lft-in96.7%
fma-def96.7%
*-rgt-identity96.7%
Simplified96.7%
Taylor expanded in z around 0 79.5%
*-commutative79.5%
clear-num79.4%
un-div-inv79.5%
Applied egg-rr79.5%
clear-num79.6%
associate-/r/79.4%
clear-num79.5%
clear-num79.5%
div-inv79.5%
associate-/r/81.1%
Applied egg-rr81.1%
Final simplification79.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= x -2.4e-33) (/ x (* z (/ z y))) (/ y (* z (/ z x)))))
assert(x < y);
double code(double x, double y, double z) {
double tmp;
if (x <= -2.4e-33) {
tmp = x / (z * (z / y));
} 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 <= (-2.4d-33)) then
tmp = x / (z * (z / y))
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 <= -2.4e-33) {
tmp = x / (z * (z / y));
} else {
tmp = y / (z * (z / x));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z): tmp = 0 if x <= -2.4e-33: tmp = x / (z * (z / y)) else: tmp = y / (z * (z / x)) return tmp
x, y = sort([x, y]) function code(x, y, z) tmp = 0.0 if (x <= -2.4e-33) tmp = Float64(x / Float64(z * Float64(z / y))); 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 <= -2.4e-33)
tmp = x / (z * (z / y));
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, -2.4e-33], N[(x / N[(z * N[(z / y), $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 -2.4 \cdot 10^{-33}:\\
\;\;\;\;\frac{x}{z \cdot \frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot \frac{z}{x}}\\
\end{array}
\end{array}
if x < -2.4e-33Initial program 75.4%
/-rgt-identity75.4%
associate-/l*75.4%
associate-/l/79.2%
associate-*l*84.1%
associate-*r/84.1%
*-rgt-identity84.1%
associate-*l*91.1%
associate-*r/91.0%
distribute-lft-in91.0%
fma-def91.1%
*-rgt-identity91.1%
Simplified91.1%
Taylor expanded in z around 0 75.2%
if -2.4e-33 < x Initial program 87.9%
associate-*l*87.9%
times-frac96.7%
distribute-lft-in96.7%
fma-def96.7%
*-rgt-identity96.7%
Simplified96.7%
Taylor expanded in z around 0 74.8%
unpow274.8%
associate-/l*77.4%
associate-/l*81.7%
associate-/r/81.6%
Simplified81.6%
Final simplification79.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (* (/ x z) (/ y z)))
assert(x < y);
double code(double x, double y, double z) {
return (x / z) * (y / 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)
end function
assert x < y;
public static double code(double x, double y, double z) {
return (x / z) * (y / z);
}
[x, y] = sort([x, y]) def code(x, y, z): return (x / z) * (y / z)
x, y = sort([x, y]) function code(x, y, z) return Float64(Float64(x / z) * Float64(y / z)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = (x / z) * (y / 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[(y / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{z} \cdot \frac{y}{z}
\end{array}
Initial program 84.1%
associate-*l*84.1%
times-frac93.8%
distribute-lft-in93.8%
fma-def93.8%
*-rgt-identity93.8%
Simplified93.8%
Taylor expanded in z around 0 75.3%
Final simplification75.3%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (* x (/ (- y) z)))
assert(x < y);
double code(double x, double y, double z) {
return x * (-y / 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 * (-y / z)
end function
assert x < y;
public static double code(double x, double y, double z) {
return x * (-y / z);
}
[x, y] = sort([x, y]) def code(x, y, z): return x * (-y / z)
x, y = sort([x, y]) function code(x, y, z) return Float64(x * Float64(Float64(-y) / z)) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z)
tmp = x * (-y / z);
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_] := N[(x * N[((-y) / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
x \cdot \frac{-y}{z}
\end{array}
Initial program 84.1%
associate-*l*84.1%
times-frac93.8%
distribute-lft-in93.8%
fma-def93.8%
*-rgt-identity93.8%
Simplified93.8%
Taylor expanded in z around 0 69.1%
neg-mul-169.1%
+-commutative69.1%
unsub-neg69.1%
Simplified69.1%
Taylor expanded in z around inf 26.3%
mul-1-neg26.3%
associate-*l/31.3%
distribute-lft-neg-in31.3%
*-commutative31.3%
distribute-frac-neg31.3%
Simplified31.3%
Final simplification31.3%
(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 2023257
(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))))