
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
(FPCore (x y z t) :precision binary64 (- (- (+ (* (+ z -1.0) (log1p (- y))) (* x (log y))) (log y)) t))
double code(double x, double y, double z, double t) {
return ((((z + -1.0) * log1p(-y)) + (x * log(y))) - log(y)) - t;
}
public static double code(double x, double y, double z, double t) {
return ((((z + -1.0) * Math.log1p(-y)) + (x * Math.log(y))) - Math.log(y)) - t;
}
def code(x, y, z, t): return ((((z + -1.0) * math.log1p(-y)) + (x * math.log(y))) - math.log(y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(Float64(z + -1.0) * log1p(Float64(-y))) + Float64(x * log(y))) - log(y)) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right) + x \cdot \log y\right) - \log y\right) - t
\end{array}
Initial program 91.1%
+-commutative91.1%
fma-def91.1%
sub-neg91.1%
metadata-eval91.1%
sub-neg91.1%
log1p-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
fma-udef99.9%
metadata-eval99.9%
sub-neg99.9%
log1p-udef91.1%
sub-neg91.1%
*-commutative91.1%
distribute-lft-in91.1%
*-commutative91.1%
associate-+r+91.1%
sub-neg91.1%
metadata-eval91.1%
sub-neg91.1%
log1p-udef99.9%
*-commutative99.9%
mul-1-neg99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (- (fma (+ z -1.0) (log1p (- y)) (* (log y) (+ -1.0 x))) t))
double code(double x, double y, double z, double t) {
return fma((z + -1.0), log1p(-y), (log(y) * (-1.0 + x))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(z + -1.0), log1p(Float64(-y)), Float64(log(y) * Float64(-1.0 + x))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Initial program 91.1%
+-commutative91.1%
fma-def91.1%
sub-neg91.1%
metadata-eval91.1%
sub-neg91.1%
log1p-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (- (+ (/ (log1p (- y)) (/ 1.0 (+ z -1.0))) (* (log y) (+ -1.0 x))) t))
double code(double x, double y, double z, double t) {
return ((log1p(-y) / (1.0 / (z + -1.0))) + (log(y) * (-1.0 + x))) - t;
}
public static double code(double x, double y, double z, double t) {
return ((Math.log1p(-y) / (1.0 / (z + -1.0))) + (Math.log(y) * (-1.0 + x))) - t;
}
def code(x, y, z, t): return ((math.log1p(-y) / (1.0 / (z + -1.0))) + (math.log(y) * (-1.0 + x))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log1p(Float64(-y)) / Float64(1.0 / Float64(z + -1.0))) + Float64(log(y) * Float64(-1.0 + x))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[1 + (-y)], $MachinePrecision] / N[(1.0 / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{\mathsf{log1p}\left(-y\right)}{\frac{1}{z + -1}} + \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Initial program 91.1%
*-commutative91.1%
sub-neg91.1%
log1p-udef99.9%
flip3--66.6%
clear-num66.6%
un-div-inv66.6%
clear-num66.6%
flip3--99.8%
sub-neg99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ z -1.0) -2e+208) (not (<= (+ z -1.0) 1e+84))) (- (- (* x (log y)) (* (+ z -1.0) y)) t) (- (+ y (* (log y) (+ -1.0 x))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((z + -1.0) <= -2e+208) || !((z + -1.0) <= 1e+84)) {
tmp = ((x * log(y)) - ((z + -1.0) * y)) - t;
} else {
tmp = (y + (log(y) * (-1.0 + x))) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((z + (-1.0d0)) <= (-2d+208)) .or. (.not. ((z + (-1.0d0)) <= 1d+84))) then
tmp = ((x * log(y)) - ((z + (-1.0d0)) * y)) - t
else
tmp = (y + (log(y) * ((-1.0d0) + x))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((z + -1.0) <= -2e+208) || !((z + -1.0) <= 1e+84)) {
tmp = ((x * Math.log(y)) - ((z + -1.0) * y)) - t;
} else {
tmp = (y + (Math.log(y) * (-1.0 + x))) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z + -1.0) <= -2e+208) or not ((z + -1.0) <= 1e+84): tmp = ((x * math.log(y)) - ((z + -1.0) * y)) - t else: tmp = (y + (math.log(y) * (-1.0 + x))) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z + -1.0) <= -2e+208) || !(Float64(z + -1.0) <= 1e+84)) tmp = Float64(Float64(Float64(x * log(y)) - Float64(Float64(z + -1.0) * y)) - t); else tmp = Float64(Float64(y + Float64(log(y) * Float64(-1.0 + x))) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z + -1.0) <= -2e+208) || ~(((z + -1.0) <= 1e+84))) tmp = ((x * log(y)) - ((z + -1.0) * y)) - t; else tmp = (y + (log(y) * (-1.0 + x))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z + -1.0), $MachinePrecision], -2e+208], N[Not[LessEqual[N[(z + -1.0), $MachinePrecision], 1e+84]], $MachinePrecision]], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(N[(z + -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z + -1 \leq -2 \cdot 10^{+208} \lor \neg \left(z + -1 \leq 10^{+84}\right):\\
\;\;\;\;\left(x \cdot \log y - \left(z + -1\right) \cdot y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(y + \log y \cdot \left(-1 + x\right)\right) - t\\
\end{array}
\end{array}
if (-.f64 z 1) < -2e208 or 1.00000000000000006e84 < (-.f64 z 1) Initial program 66.0%
Taylor expanded in y around 0 99.0%
mul-1-neg99.0%
Simplified99.0%
Taylor expanded in x around inf 94.6%
*-commutative94.6%
Simplified94.6%
*-commutative94.6%
sub-neg94.6%
metadata-eval94.6%
cancel-sign-sub-inv94.6%
*-commutative94.6%
Applied egg-rr94.6%
if -2e208 < (-.f64 z 1) < 1.00000000000000006e84Initial program 99.4%
Taylor expanded in y around 0 99.6%
mul-1-neg99.6%
Simplified99.6%
Taylor expanded in z around 0 99.1%
Final simplification98.0%
(FPCore (x y z t)
:precision binary64
(if (<= (+ z -1.0) -2e+208)
(- (* z (log1p (- y))) t)
(if (<= (+ z -1.0) 5e+210)
(- (+ y (* (log y) (+ -1.0 x))) t)
(- (* z (- y)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z + -1.0) <= -2e+208) {
tmp = (z * log1p(-y)) - t;
} else if ((z + -1.0) <= 5e+210) {
tmp = (y + (log(y) * (-1.0 + x))) - t;
} else {
tmp = (z * -y) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z + -1.0) <= -2e+208) {
tmp = (z * Math.log1p(-y)) - t;
} else if ((z + -1.0) <= 5e+210) {
tmp = (y + (Math.log(y) * (-1.0 + x))) - t;
} else {
tmp = (z * -y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z + -1.0) <= -2e+208: tmp = (z * math.log1p(-y)) - t elif (z + -1.0) <= 5e+210: tmp = (y + (math.log(y) * (-1.0 + x))) - t else: tmp = (z * -y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z + -1.0) <= -2e+208) tmp = Float64(Float64(z * log1p(Float64(-y))) - t); elseif (Float64(z + -1.0) <= 5e+210) tmp = Float64(Float64(y + Float64(log(y) * Float64(-1.0 + x))) - t); else tmp = Float64(Float64(z * Float64(-y)) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z + -1.0), $MachinePrecision], -2e+208], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(z + -1.0), $MachinePrecision], 5e+210], N[(N[(y + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z + -1 \leq -2 \cdot 10^{+208}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\mathbf{elif}\;z + -1 \leq 5 \cdot 10^{+210}:\\
\;\;\;\;\left(y + \log y \cdot \left(-1 + x\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right) - t\\
\end{array}
\end{array}
if (-.f64 z 1) < -2e208Initial program 58.0%
Taylor expanded in z around inf 32.8%
sub-neg32.8%
log1p-def74.9%
Simplified74.9%
if -2e208 < (-.f64 z 1) < 4.9999999999999998e210Initial program 97.4%
Taylor expanded in y around 0 99.4%
mul-1-neg99.4%
Simplified99.4%
Taylor expanded in z around 0 96.7%
if 4.9999999999999998e210 < (-.f64 z 1) Initial program 46.0%
Taylor expanded in y around 0 100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in z around inf 82.6%
associate-*r*82.6%
neg-mul-182.6%
Simplified82.6%
Final simplification93.8%
(FPCore (x y z t) :precision binary64 (if (<= (+ z -1.0) -2e+208) (- (* z (log1p (- y))) t) (if (<= (+ z -1.0) 5e+210) (- (* (log y) (+ -1.0 x)) t) (- (* z (- y)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z + -1.0) <= -2e+208) {
tmp = (z * log1p(-y)) - t;
} else if ((z + -1.0) <= 5e+210) {
tmp = (log(y) * (-1.0 + x)) - t;
} else {
tmp = (z * -y) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z + -1.0) <= -2e+208) {
tmp = (z * Math.log1p(-y)) - t;
} else if ((z + -1.0) <= 5e+210) {
tmp = (Math.log(y) * (-1.0 + x)) - t;
} else {
tmp = (z * -y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z + -1.0) <= -2e+208: tmp = (z * math.log1p(-y)) - t elif (z + -1.0) <= 5e+210: tmp = (math.log(y) * (-1.0 + x)) - t else: tmp = (z * -y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z + -1.0) <= -2e+208) tmp = Float64(Float64(z * log1p(Float64(-y))) - t); elseif (Float64(z + -1.0) <= 5e+210) tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); else tmp = Float64(Float64(z * Float64(-y)) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z + -1.0), $MachinePrecision], -2e+208], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(z + -1.0), $MachinePrecision], 5e+210], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z + -1 \leq -2 \cdot 10^{+208}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\mathbf{elif}\;z + -1 \leq 5 \cdot 10^{+210}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right) - t\\
\end{array}
\end{array}
if (-.f64 z 1) < -2e208Initial program 58.0%
Taylor expanded in z around inf 32.8%
sub-neg32.8%
log1p-def74.9%
Simplified74.9%
if -2e208 < (-.f64 z 1) < 4.9999999999999998e210Initial program 97.4%
+-commutative97.4%
fma-def97.4%
sub-neg97.4%
metadata-eval97.4%
sub-neg97.4%
log1p-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 96.5%
if 4.9999999999999998e210 < (-.f64 z 1) Initial program 46.0%
Taylor expanded in y around 0 100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in z around inf 82.6%
associate-*r*82.6%
neg-mul-182.6%
Simplified82.6%
Final simplification93.6%
(FPCore (x y z t) :precision binary64 (- (- (* (log y) (+ -1.0 x)) (* (+ z -1.0) y)) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) - ((z + -1.0) * y)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((log(y) * ((-1.0d0) + x)) - ((z + (-1.0d0)) * y)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (-1.0 + x)) - ((z + -1.0) * y)) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) - ((z + -1.0) * y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) - Float64(Float64(z + -1.0) * y)) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (-1.0 + x)) - ((z + -1.0) * y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - N[(N[(z + -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(-1 + x\right) - \left(z + -1\right) \cdot y\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 99.4%
mul-1-neg99.4%
Simplified99.4%
*-commutative99.4%
cancel-sign-sub-inv99.4%
*-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
sub-neg99.4%
metadata-eval99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ z -1.0) -2e+208) (not (<= (+ z -1.0) 1e+84))) (- (* z (- y)) t) (- (- t) (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z + -1.0) <= -2e+208) || !((z + -1.0) <= 1e+84)) {
tmp = (z * -y) - t;
} else {
tmp = -t - log(y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((z + (-1.0d0)) <= (-2d+208)) .or. (.not. ((z + (-1.0d0)) <= 1d+84))) then
tmp = (z * -y) - t
else
tmp = -t - log(y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((z + -1.0) <= -2e+208) || !((z + -1.0) <= 1e+84)) {
tmp = (z * -y) - t;
} else {
tmp = -t - Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z + -1.0) <= -2e+208) or not ((z + -1.0) <= 1e+84): tmp = (z * -y) - t else: tmp = -t - math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z + -1.0) <= -2e+208) || !(Float64(z + -1.0) <= 1e+84)) tmp = Float64(Float64(z * Float64(-y)) - t); else tmp = Float64(Float64(-t) - log(y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z + -1.0) <= -2e+208) || ~(((z + -1.0) <= 1e+84))) tmp = (z * -y) - t; else tmp = -t - log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z + -1.0), $MachinePrecision], -2e+208], N[Not[LessEqual[N[(z + -1.0), $MachinePrecision], 1e+84]], $MachinePrecision]], N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z + -1 \leq -2 \cdot 10^{+208} \lor \neg \left(z + -1 \leq 10^{+84}\right):\\
\;\;\;\;z \cdot \left(-y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \log y\\
\end{array}
\end{array}
if (-.f64 z 1) < -2e208 or 1.00000000000000006e84 < (-.f64 z 1) Initial program 66.0%
Taylor expanded in y around 0 99.0%
mul-1-neg99.0%
Simplified99.0%
Taylor expanded in z around inf 62.2%
associate-*r*62.2%
neg-mul-162.2%
Simplified62.2%
if -2e208 < (-.f64 z 1) < 1.00000000000000006e84Initial program 99.4%
+-commutative99.4%
fma-def99.4%
sub-neg99.4%
metadata-eval99.4%
sub-neg99.4%
log1p-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
flip3--42.4%
clear-num42.3%
clear-num42.3%
Applied egg-rr99.6%
Taylor expanded in y around 0 98.6%
Taylor expanded in x around 0 65.1%
mul-1-neg65.1%
Simplified65.1%
Final simplification64.4%
(FPCore (x y z t) :precision binary64 (- (- (* (log y) (+ -1.0 x)) (* z y)) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) - (z * y)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((log(y) * ((-1.0d0) + x)) - (z * y)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (-1.0 + x)) - (z * y)) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) - (z * y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) - Float64(z * y)) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (-1.0 + x)) - (z * y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(-1 + x\right) - z \cdot y\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 99.4%
mul-1-neg99.4%
Simplified99.4%
*-commutative99.4%
cancel-sign-sub-inv99.4%
*-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
sub-neg99.4%
metadata-eval99.4%
Applied egg-rr99.4%
Taylor expanded in z around inf 99.2%
Final simplification99.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.25e+29) (not (<= x 19.0))) (- (* x (log y)) t) (- (- t) (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.25e+29) || !(x <= 19.0)) {
tmp = (x * log(y)) - t;
} else {
tmp = -t - log(y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.25d+29)) .or. (.not. (x <= 19.0d0))) then
tmp = (x * log(y)) - t
else
tmp = -t - log(y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.25e+29) || !(x <= 19.0)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = -t - Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.25e+29) or not (x <= 19.0): tmp = (x * math.log(y)) - t else: tmp = -t - math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.25e+29) || !(x <= 19.0)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(-t) - log(y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.25e+29) || ~((x <= 19.0))) tmp = (x * log(y)) - t; else tmp = -t - log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.25e+29], N[Not[LessEqual[x, 19.0]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{+29} \lor \neg \left(x \leq 19\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \log y\\
\end{array}
\end{array}
if x < -1.25e29 or 19 < x Initial program 93.2%
*-commutative93.2%
sub-neg93.2%
log1p-udef99.8%
flip3--61.8%
clear-num61.8%
un-div-inv61.8%
clear-num61.8%
flip3--99.8%
sub-neg99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 92.8%
if -1.25e29 < x < 19Initial program 89.0%
+-commutative89.0%
fma-def89.0%
sub-neg89.0%
metadata-eval89.0%
sub-neg89.0%
log1p-def100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
flip3--58.7%
clear-num58.6%
clear-num58.6%
Applied egg-rr99.7%
Taylor expanded in y around 0 87.3%
Taylor expanded in x around 0 86.8%
mul-1-neg86.8%
Simplified86.8%
Final simplification89.8%
(FPCore (x y z t) :precision binary64 (if (<= t -5e-7) (- t) (if (<= t 4.6e+23) (* z (- y)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5e-7) {
tmp = -t;
} else if (t <= 4.6e+23) {
tmp = z * -y;
} else {
tmp = -t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-5d-7)) then
tmp = -t
else if (t <= 4.6d+23) then
tmp = z * -y
else
tmp = -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5e-7) {
tmp = -t;
} else if (t <= 4.6e+23) {
tmp = z * -y;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -5e-7: tmp = -t elif t <= 4.6e+23: tmp = z * -y else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -5e-7) tmp = Float64(-t); elseif (t <= 4.6e+23) tmp = Float64(z * Float64(-y)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -5e-7) tmp = -t; elseif (t <= 4.6e+23) tmp = z * -y; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -5e-7], (-t), If[LessEqual[t, 4.6e+23], N[(z * (-y)), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{-7}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 4.6 \cdot 10^{+23}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -4.99999999999999977e-7 or 4.6000000000000001e23 < t Initial program 96.8%
+-commutative96.8%
fma-def96.8%
sub-neg96.8%
metadata-eval96.8%
sub-neg96.8%
log1p-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 73.2%
mul-1-neg73.2%
Simplified73.2%
if -4.99999999999999977e-7 < t < 4.6000000000000001e23Initial program 85.4%
Taylor expanded in y around 0 99.2%
mul-1-neg99.2%
Simplified99.2%
Taylor expanded in z around inf 18.1%
associate-*r*18.1%
neg-mul-118.1%
Simplified18.1%
Taylor expanded in y around inf 17.4%
mul-1-neg17.4%
distribute-rgt-neg-out17.4%
Simplified17.4%
Final simplification45.1%
(FPCore (x y z t) :precision binary64 (- (* y (- 1.0 z)) t))
double code(double x, double y, double z, double t) {
return (y * (1.0 - z)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (y * (1.0d0 - z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * (1.0 - z)) - t;
}
def code(x, y, z, t): return (y * (1.0 - z)) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(1.0 - z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * (1.0 - z)) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(1 - z\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 99.4%
mul-1-neg99.4%
Simplified99.4%
*-commutative99.4%
cancel-sign-sub-inv99.4%
*-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
sub-neg99.4%
metadata-eval99.4%
Applied egg-rr99.4%
Taylor expanded in y around inf 47.0%
Final simplification47.0%
(FPCore (x y z t) :precision binary64 (- (* z (- y)) t))
double code(double x, double y, double z, double t) {
return (z * -y) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (z * -y) - t
end function
public static double code(double x, double y, double z, double t) {
return (z * -y) - t;
}
def code(x, y, z, t): return (z * -y) - t
function code(x, y, z, t) return Float64(Float64(z * Float64(-y)) - t) end
function tmp = code(x, y, z, t) tmp = (z * -y) - t; end
code[x_, y_, z_, t_] := N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(-y\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 99.4%
mul-1-neg99.4%
Simplified99.4%
Taylor expanded in z around inf 46.8%
associate-*r*46.8%
neg-mul-146.8%
Simplified46.8%
Final simplification46.8%
(FPCore (x y z t) :precision binary64 (- t))
double code(double x, double y, double z, double t) {
return -t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -t
end function
public static double code(double x, double y, double z, double t) {
return -t;
}
def code(x, y, z, t): return -t
function code(x, y, z, t) return Float64(-t) end
function tmp = code(x, y, z, t) tmp = -t; end
code[x_, y_, z_, t_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 91.1%
+-commutative91.1%
fma-def91.1%
sub-neg91.1%
metadata-eval91.1%
sub-neg91.1%
log1p-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 38.0%
mul-1-neg38.0%
Simplified38.0%
Final simplification38.0%
herbie shell --seed 2023297
(FPCore (x y z t)
:name "Statistics.Distribution.Beta:$cdensity from math-functions-0.1.5.2"
:precision binary64
(- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))