
(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 13 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 (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 fma(Float64(z + -1.0), log1p(Float64(-y)), Float64(Float64(log(y) * Float64(-1.0 + x)) - t)) end
code[x_, y_, z_, t_] := N[(N[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \log y \cdot \left(-1 + x\right) - t\right)
\end{array}
Initial program 91.2%
sub-neg91.2%
+-commutative91.2%
associate-+l+91.2%
fma-def91.2%
sub-neg91.2%
metadata-eval91.2%
sub-neg91.2%
log1p-def99.9%
sub-neg99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- 1.0 z))))
(if (or (<= (+ -1.0 x) -50.0) (not (<= (+ -1.0 x) -1.0)))
(- (+ t_1 (* x (log y))) t)
(- (- t_1 (log y)) t))))
double code(double x, double y, double z, double t) {
double t_1 = y * (1.0 - z);
double tmp;
if (((-1.0 + x) <= -50.0) || !((-1.0 + x) <= -1.0)) {
tmp = (t_1 + (x * log(y))) - t;
} else {
tmp = (t_1 - log(y)) - 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) :: t_1
real(8) :: tmp
t_1 = y * (1.0d0 - z)
if ((((-1.0d0) + x) <= (-50.0d0)) .or. (.not. (((-1.0d0) + x) <= (-1.0d0)))) then
tmp = (t_1 + (x * log(y))) - t
else
tmp = (t_1 - log(y)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (1.0 - z);
double tmp;
if (((-1.0 + x) <= -50.0) || !((-1.0 + x) <= -1.0)) {
tmp = (t_1 + (x * Math.log(y))) - t;
} else {
tmp = (t_1 - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (1.0 - z) tmp = 0 if ((-1.0 + x) <= -50.0) or not ((-1.0 + x) <= -1.0): tmp = (t_1 + (x * math.log(y))) - t else: tmp = (t_1 - math.log(y)) - t return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(1.0 - z)) tmp = 0.0 if ((Float64(-1.0 + x) <= -50.0) || !(Float64(-1.0 + x) <= -1.0)) tmp = Float64(Float64(t_1 + Float64(x * log(y))) - t); else tmp = Float64(Float64(t_1 - log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (1.0 - z); tmp = 0.0; if (((-1.0 + x) <= -50.0) || ~(((-1.0 + x) <= -1.0))) tmp = (t_1 + (x * log(y))) - t; else tmp = (t_1 - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[N[(-1.0 + x), $MachinePrecision], -50.0], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], -1.0]], $MachinePrecision]], N[(N[(t$95$1 + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(t$95$1 - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(1 - z\right)\\
\mathbf{if}\;-1 + x \leq -50 \lor \neg \left(-1 + x \leq -1\right):\\
\;\;\;\;\left(t_1 + x \cdot \log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 - \log y\right) - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -50 or -1 < (-.f64 x 1) Initial program 95.0%
Taylor expanded in y around 0 99.3%
mul-1-neg99.3%
sub-neg99.3%
metadata-eval99.3%
distribute-rgt-neg-in99.3%
mul-1-neg99.3%
+-commutative99.3%
distribute-lft-in99.3%
metadata-eval99.3%
neg-mul-199.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in x around inf 99.3%
*-commutative99.3%
Simplified99.3%
if -50 < (-.f64 x 1) < -1Initial program 87.1%
Taylor expanded in y around 0 99.5%
mul-1-neg99.5%
sub-neg99.5%
metadata-eval99.5%
distribute-rgt-neg-in99.5%
mul-1-neg99.5%
+-commutative99.5%
distribute-lft-in99.5%
metadata-eval99.5%
neg-mul-199.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in x around 0 98.8%
mul-1-neg98.8%
Simplified98.8%
Taylor expanded in y around 0 98.8%
mul-1-neg98.8%
log-rec98.8%
+-commutative98.8%
log-rec98.8%
unsub-neg98.8%
Simplified98.8%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ -1.0 x) -5e+15) (not (<= (+ -1.0 x) 200000000000.0))) (- (* x (log y)) t) (- (- (* y (- 1.0 z)) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -5e+15) || !((-1.0 + x) <= 200000000000.0)) {
tmp = (x * log(y)) - t;
} else {
tmp = ((y * (1.0 - z)) - log(y)) - 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 ((((-1.0d0) + x) <= (-5d+15)) .or. (.not. (((-1.0d0) + x) <= 200000000000.0d0))) then
tmp = (x * log(y)) - t
else
tmp = ((y * (1.0d0 - z)) - log(y)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -5e+15) || !((-1.0 + x) <= 200000000000.0)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = ((y * (1.0 - z)) - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((-1.0 + x) <= -5e+15) or not ((-1.0 + x) <= 200000000000.0): tmp = (x * math.log(y)) - t else: tmp = ((y * (1.0 - z)) - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(-1.0 + x) <= -5e+15) || !(Float64(-1.0 + x) <= 200000000000.0)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(Float64(y * Float64(1.0 - z)) - log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((-1.0 + x) <= -5e+15) || ~(((-1.0 + x) <= 200000000000.0))) tmp = (x * log(y)) - t; else tmp = ((y * (1.0 - z)) - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(-1.0 + x), $MachinePrecision], -5e+15], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], 200000000000.0]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -5 \cdot 10^{+15} \lor \neg \left(-1 + x \leq 200000000000\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot \left(1 - z\right) - \log y\right) - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -5e15 or 2e11 < (-.f64 x 1) Initial program 95.7%
Taylor expanded in y around 0 99.3%
mul-1-neg99.3%
sub-neg99.3%
metadata-eval99.3%
distribute-rgt-neg-in99.3%
mul-1-neg99.3%
+-commutative99.3%
distribute-lft-in99.3%
metadata-eval99.3%
neg-mul-199.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in x around inf 94.8%
*-commutative94.8%
Simplified94.8%
if -5e15 < (-.f64 x 1) < 2e11Initial program 86.8%
Taylor expanded in y around 0 99.5%
mul-1-neg99.5%
sub-neg99.5%
metadata-eval99.5%
distribute-rgt-neg-in99.5%
mul-1-neg99.5%
+-commutative99.5%
distribute-lft-in99.5%
metadata-eval99.5%
neg-mul-199.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in x around 0 98.9%
mul-1-neg98.9%
Simplified98.9%
Taylor expanded in y around 0 98.9%
mul-1-neg98.9%
log-rec98.9%
+-commutative98.9%
log-rec98.9%
unsub-neg98.9%
Simplified98.9%
Final simplification96.9%
(FPCore (x y z t)
:precision binary64
(if (<= (+ -1.0 x) -5e+15)
(- (* x (log y)) t)
(if (<= (+ -1.0 x) 200000000000.0)
(- (- (* y (- 1.0 z)) (log y)) t)
(- (/ (log y) (/ 1.0 (+ -1.0 x))) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((-1.0 + x) <= -5e+15) {
tmp = (x * log(y)) - t;
} else if ((-1.0 + x) <= 200000000000.0) {
tmp = ((y * (1.0 - z)) - log(y)) - t;
} else {
tmp = (log(y) / (1.0 / (-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 (((-1.0d0) + x) <= (-5d+15)) then
tmp = (x * log(y)) - t
else if (((-1.0d0) + x) <= 200000000000.0d0) then
tmp = ((y * (1.0d0 - z)) - log(y)) - t
else
tmp = (log(y) / (1.0d0 / ((-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 ((-1.0 + x) <= -5e+15) {
tmp = (x * Math.log(y)) - t;
} else if ((-1.0 + x) <= 200000000000.0) {
tmp = ((y * (1.0 - z)) - Math.log(y)) - t;
} else {
tmp = (Math.log(y) / (1.0 / (-1.0 + x))) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (-1.0 + x) <= -5e+15: tmp = (x * math.log(y)) - t elif (-1.0 + x) <= 200000000000.0: tmp = ((y * (1.0 - z)) - math.log(y)) - t else: tmp = (math.log(y) / (1.0 / (-1.0 + x))) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(-1.0 + x) <= -5e+15) tmp = Float64(Float64(x * log(y)) - t); elseif (Float64(-1.0 + x) <= 200000000000.0) tmp = Float64(Float64(Float64(y * Float64(1.0 - z)) - log(y)) - t); else tmp = Float64(Float64(log(y) / Float64(1.0 / Float64(-1.0 + x))) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((-1.0 + x) <= -5e+15) tmp = (x * log(y)) - t; elseif ((-1.0 + x) <= 200000000000.0) tmp = ((y * (1.0 - z)) - log(y)) - t; else tmp = (log(y) / (1.0 / (-1.0 + x))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(-1.0 + x), $MachinePrecision], -5e+15], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(-1.0 + x), $MachinePrecision], 200000000000.0], N[(N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] / N[(1.0 / N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -5 \cdot 10^{+15}:\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{elif}\;-1 + x \leq 200000000000:\\
\;\;\;\;\left(y \cdot \left(1 - z\right) - \log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\frac{\log y}{\frac{1}{-1 + x}} - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -5e15Initial program 97.8%
Taylor expanded in y around 0 99.8%
mul-1-neg99.8%
sub-neg99.8%
metadata-eval99.8%
distribute-rgt-neg-in99.8%
mul-1-neg99.8%
+-commutative99.8%
distribute-lft-in99.8%
metadata-eval99.8%
neg-mul-199.8%
unsub-neg99.8%
Simplified99.8%
Taylor expanded in x around inf 97.7%
*-commutative97.7%
Simplified97.7%
if -5e15 < (-.f64 x 1) < 2e11Initial program 86.8%
Taylor expanded in y around 0 99.5%
mul-1-neg99.5%
sub-neg99.5%
metadata-eval99.5%
distribute-rgt-neg-in99.5%
mul-1-neg99.5%
+-commutative99.5%
distribute-lft-in99.5%
metadata-eval99.5%
neg-mul-199.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in x around 0 98.9%
mul-1-neg98.9%
Simplified98.9%
Taylor expanded in y around 0 98.9%
mul-1-neg98.9%
log-rec98.9%
+-commutative98.9%
log-rec98.9%
unsub-neg98.9%
Simplified98.9%
if 2e11 < (-.f64 x 1) Initial program 93.6%
sub-neg93.6%
+-commutative93.6%
associate-+l+93.6%
fma-def93.6%
sub-neg93.6%
metadata-eval93.6%
sub-neg93.6%
log1p-def99.6%
sub-neg99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around 0 92.0%
*-commutative92.0%
sub-neg92.0%
metadata-eval92.0%
/-rgt-identity92.0%
metadata-eval92.0%
sub-neg92.0%
*-commutative92.0%
associate-/l*92.1%
sub-neg92.1%
metadata-eval92.1%
Applied egg-rr92.1%
Final simplification96.9%
(FPCore (x y z t) :precision binary64 (- (+ (* y (- 1.0 z)) (* (log y) (+ -1.0 x))) t))
double code(double x, double y, double z, double t) {
return ((y * (1.0 - z)) + (log(y) * (-1.0 + x))) - 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)) + (log(y) * ((-1.0d0) + x))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((y * (1.0 - z)) + (Math.log(y) * (-1.0 + x))) - t;
}
def code(x, y, z, t): return ((y * (1.0 - z)) + (math.log(y) * (-1.0 + x))) - t
function code(x, y, z, t) return Float64(Float64(Float64(y * Float64(1.0 - z)) + Float64(log(y) * Float64(-1.0 + x))) - t) end
function tmp = code(x, y, z, t) tmp = ((y * (1.0 - z)) + (log(y) * (-1.0 + x))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(y \cdot \left(1 - z\right) + \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Initial program 91.2%
Taylor expanded in y around 0 99.4%
mul-1-neg99.4%
sub-neg99.4%
metadata-eval99.4%
distribute-rgt-neg-in99.4%
mul-1-neg99.4%
+-commutative99.4%
distribute-lft-in99.4%
metadata-eval99.4%
neg-mul-199.4%
unsub-neg99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.02e+239)
(- (* z (- y)) t)
(if (<= z 2.8e+243)
(- (* (log y) (+ -1.0 x)) t)
(- (* z (log1p (- y))) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.02e+239) {
tmp = (z * -y) - t;
} else if (z <= 2.8e+243) {
tmp = (log(y) * (-1.0 + x)) - t;
} else {
tmp = (z * log1p(-y)) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.02e+239) {
tmp = (z * -y) - t;
} else if (z <= 2.8e+243) {
tmp = (Math.log(y) * (-1.0 + x)) - t;
} else {
tmp = (z * Math.log1p(-y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.02e+239: tmp = (z * -y) - t elif z <= 2.8e+243: tmp = (math.log(y) * (-1.0 + x)) - t else: tmp = (z * math.log1p(-y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.02e+239) tmp = Float64(Float64(z * Float64(-y)) - t); elseif (z <= 2.8e+243) tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); else tmp = Float64(Float64(z * log1p(Float64(-y))) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.02e+239], N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[z, 2.8e+243], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{+239}:\\
\;\;\;\;z \cdot \left(-y\right) - t\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+243}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\end{array}
\end{array}
if z < -1.02e239Initial program 35.2%
Taylor expanded in y around 0 100.0%
mul-1-neg100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
mul-1-neg100.0%
+-commutative100.0%
distribute-lft-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in z around inf 88.8%
mul-1-neg88.8%
distribute-rgt-neg-in88.8%
Simplified88.8%
if -1.02e239 < z < 2.7999999999999999e243Initial program 95.0%
sub-neg95.0%
+-commutative95.0%
associate-+l+95.0%
fma-def95.0%
sub-neg95.0%
metadata-eval95.0%
sub-neg95.0%
log1p-def99.9%
sub-neg99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 94.7%
if 2.7999999999999999e243 < z Initial program 57.3%
Taylor expanded in x around 0 42.8%
+-commutative42.8%
mul-1-neg42.8%
unsub-neg42.8%
sub-neg42.8%
mul-1-neg42.8%
log1p-def84.6%
mul-1-neg84.6%
sub-neg84.6%
metadata-eval84.6%
+-commutative84.6%
Simplified84.6%
Taylor expanded in z around inf 43.1%
sub-neg43.1%
log1p-def84.6%
Simplified84.6%
Final simplification94.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -18500000000.0) (not (<= x 7.6e-19))) (- (* x (log y)) t) (- (- (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -18500000000.0) || !(x <= 7.6e-19)) {
tmp = (x * log(y)) - t;
} else {
tmp = -log(y) - 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 ((x <= (-18500000000.0d0)) .or. (.not. (x <= 7.6d-19))) then
tmp = (x * log(y)) - t
else
tmp = -log(y) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -18500000000.0) || !(x <= 7.6e-19)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = -Math.log(y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -18500000000.0) or not (x <= 7.6e-19): tmp = (x * math.log(y)) - t else: tmp = -math.log(y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -18500000000.0) || !(x <= 7.6e-19)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(-log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -18500000000.0) || ~((x <= 7.6e-19))) tmp = (x * log(y)) - t; else tmp = -log(y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -18500000000.0], N[Not[LessEqual[x, 7.6e-19]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -18500000000 \lor \neg \left(x \leq 7.6 \cdot 10^{-19}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(-\log y\right) - t\\
\end{array}
\end{array}
if x < -1.85e10 or 7.6e-19 < x Initial program 95.7%
Taylor expanded in y around 0 99.3%
mul-1-neg99.3%
sub-neg99.3%
metadata-eval99.3%
distribute-rgt-neg-in99.3%
mul-1-neg99.3%
+-commutative99.3%
distribute-lft-in99.3%
metadata-eval99.3%
neg-mul-199.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in x around inf 94.9%
*-commutative94.9%
Simplified94.9%
if -1.85e10 < x < 7.6e-19Initial program 86.4%
Taylor expanded in y around 0 99.5%
mul-1-neg99.5%
sub-neg99.5%
metadata-eval99.5%
distribute-rgt-neg-in99.5%
mul-1-neg99.5%
+-commutative99.5%
distribute-lft-in99.5%
metadata-eval99.5%
neg-mul-199.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in x around 0 98.8%
mul-1-neg98.8%
Simplified98.8%
Taylor expanded in y around 0 85.1%
mul-1-neg85.1%
Simplified85.1%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.5e+170) (not (<= z 2.05e+36))) (- (* z (- y)) t) (- (- (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.5e+170) || !(z <= 2.05e+36)) {
tmp = (z * -y) - t;
} else {
tmp = -log(y) - 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 <= (-4.5d+170)) .or. (.not. (z <= 2.05d+36))) then
tmp = (z * -y) - t
else
tmp = -log(y) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.5e+170) || !(z <= 2.05e+36)) {
tmp = (z * -y) - t;
} else {
tmp = -Math.log(y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.5e+170) or not (z <= 2.05e+36): tmp = (z * -y) - t else: tmp = -math.log(y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.5e+170) || !(z <= 2.05e+36)) tmp = Float64(Float64(z * Float64(-y)) - t); else tmp = Float64(Float64(-log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.5e+170) || ~((z <= 2.05e+36))) tmp = (z * -y) - t; else tmp = -log(y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.5e+170], N[Not[LessEqual[z, 2.05e+36]], $MachinePrecision]], N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+170} \lor \neg \left(z \leq 2.05 \cdot 10^{+36}\right):\\
\;\;\;\;z \cdot \left(-y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-\log y\right) - t\\
\end{array}
\end{array}
if z < -4.50000000000000022e170 or 2.05000000000000006e36 < z Initial program 74.8%
Taylor expanded in y around 0 98.4%
mul-1-neg98.4%
sub-neg98.4%
metadata-eval98.4%
distribute-rgt-neg-in98.4%
mul-1-neg98.4%
+-commutative98.4%
distribute-lft-in98.4%
metadata-eval98.4%
neg-mul-198.4%
unsub-neg98.4%
Simplified98.4%
Taylor expanded in z around inf 58.5%
mul-1-neg58.5%
distribute-rgt-neg-in58.5%
Simplified58.5%
if -4.50000000000000022e170 < z < 2.05000000000000006e36Initial program 99.3%
Taylor expanded in y around 0 99.9%
mul-1-neg99.9%
sub-neg99.9%
metadata-eval99.9%
distribute-rgt-neg-in99.9%
mul-1-neg99.9%
+-commutative99.9%
distribute-lft-in99.9%
metadata-eval99.9%
neg-mul-199.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in x around 0 64.3%
mul-1-neg64.3%
Simplified64.3%
Taylor expanded in y around 0 63.8%
mul-1-neg63.8%
Simplified63.8%
Final simplification62.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7.3e-59) (not (<= t 1.4e-22))) (- t) (* z (- y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.3e-59) || !(t <= 1.4e-22)) {
tmp = -t;
} else {
tmp = z * -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 ((t <= (-7.3d-59)) .or. (.not. (t <= 1.4d-22))) then
tmp = -t
else
tmp = z * -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7.3e-59) || !(t <= 1.4e-22)) {
tmp = -t;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -7.3e-59) or not (t <= 1.4e-22): tmp = -t else: tmp = z * -y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -7.3e-59) || !(t <= 1.4e-22)) tmp = Float64(-t); else tmp = Float64(z * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -7.3e-59) || ~((t <= 1.4e-22))) tmp = -t; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -7.3e-59], N[Not[LessEqual[t, 1.4e-22]], $MachinePrecision]], (-t), N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.3 \cdot 10^{-59} \lor \neg \left(t \leq 1.4 \cdot 10^{-22}\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if t < -7.3000000000000004e-59 or 1.39999999999999997e-22 < t Initial program 99.4%
sub-neg99.4%
+-commutative99.4%
associate-+l+99.4%
fma-def99.4%
sub-neg99.4%
metadata-eval99.4%
sub-neg99.4%
log1p-def99.9%
sub-neg99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 75.1%
neg-mul-175.1%
Simplified75.1%
if -7.3000000000000004e-59 < t < 1.39999999999999997e-22Initial program 83.6%
Taylor expanded in y around 0 99.1%
mul-1-neg99.1%
sub-neg99.1%
metadata-eval99.1%
distribute-rgt-neg-in99.1%
mul-1-neg99.1%
+-commutative99.1%
distribute-lft-in99.1%
metadata-eval99.1%
neg-mul-199.1%
unsub-neg99.1%
Simplified99.1%
Taylor expanded in z around inf 18.5%
mul-1-neg18.5%
distribute-rgt-neg-in18.5%
Simplified18.5%
Taylor expanded in y around inf 18.4%
mul-1-neg18.4%
distribute-rgt-neg-in18.4%
Simplified18.4%
Final simplification45.6%
(FPCore (x y z t) :precision binary64 (if (<= t -7e-59) (- (* z y) t) (if (<= t 1.02e-22) (* z (- y)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7e-59) {
tmp = (z * y) - t;
} else if (t <= 1.02e-22) {
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 <= (-7d-59)) then
tmp = (z * y) - t
else if (t <= 1.02d-22) 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 <= -7e-59) {
tmp = (z * y) - t;
} else if (t <= 1.02e-22) {
tmp = z * -y;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -7e-59: tmp = (z * y) - t elif t <= 1.02e-22: tmp = z * -y else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -7e-59) tmp = Float64(Float64(z * y) - t); elseif (t <= 1.02e-22) 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 <= -7e-59) tmp = (z * y) - t; elseif (t <= 1.02e-22) tmp = z * -y; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -7e-59], N[(N[(z * y), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t, 1.02e-22], N[(z * (-y)), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7 \cdot 10^{-59}:\\
\;\;\;\;z \cdot y - t\\
\mathbf{elif}\;t \leq 1.02 \cdot 10^{-22}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -7.0000000000000002e-59Initial program 99.2%
Taylor expanded in y around 0 99.4%
mul-1-neg99.4%
sub-neg99.4%
metadata-eval99.4%
distribute-rgt-neg-in99.4%
mul-1-neg99.4%
+-commutative99.4%
distribute-lft-in99.4%
metadata-eval99.4%
neg-mul-199.4%
unsub-neg99.4%
Simplified99.4%
Taylor expanded in z around inf 73.3%
mul-1-neg73.3%
distribute-rgt-neg-in73.3%
Simplified73.3%
sub-neg73.3%
*-commutative73.3%
add-sqr-sqrt34.1%
sqrt-unprod63.1%
sqr-neg63.1%
sqrt-unprod38.3%
add-sqr-sqrt72.4%
Applied egg-rr72.4%
if -7.0000000000000002e-59 < t < 1.02000000000000002e-22Initial program 83.6%
Taylor expanded in y around 0 99.1%
mul-1-neg99.1%
sub-neg99.1%
metadata-eval99.1%
distribute-rgt-neg-in99.1%
mul-1-neg99.1%
+-commutative99.1%
distribute-lft-in99.1%
metadata-eval99.1%
neg-mul-199.1%
unsub-neg99.1%
Simplified99.1%
Taylor expanded in z around inf 18.5%
mul-1-neg18.5%
distribute-rgt-neg-in18.5%
Simplified18.5%
Taylor expanded in y around inf 18.4%
mul-1-neg18.4%
distribute-rgt-neg-in18.4%
Simplified18.4%
if 1.02000000000000002e-22 < t Initial program 99.7%
sub-neg99.7%
+-commutative99.7%
associate-+l+99.7%
fma-def99.7%
sub-neg99.7%
metadata-eval99.7%
sub-neg99.7%
log1p-def100.0%
sub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in t around inf 78.8%
neg-mul-178.8%
Simplified78.8%
Final simplification45.6%
(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.2%
Taylor expanded in y around 0 99.4%
mul-1-neg99.4%
sub-neg99.4%
metadata-eval99.4%
distribute-rgt-neg-in99.4%
mul-1-neg99.4%
+-commutative99.4%
distribute-lft-in99.4%
metadata-eval99.4%
neg-mul-199.4%
unsub-neg99.4%
Simplified99.4%
*-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
distribute-lft-in99.4%
Applied egg-rr99.4%
distribute-lft-out99.4%
metadata-eval99.4%
sub-neg99.4%
flip--77.6%
metadata-eval77.6%
fma-neg77.6%
metadata-eval77.6%
+-commutative77.6%
associate-*r/77.6%
*-commutative77.6%
clear-num77.5%
clear-num77.5%
associate-*l/77.6%
metadata-eval77.6%
fma-neg77.6%
metadata-eval77.6%
+-commutative77.6%
flip--99.3%
sub-neg99.3%
metadata-eval99.3%
Applied egg-rr99.3%
Taylor expanded in y around inf 46.2%
Final simplification46.2%
(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.2%
Taylor expanded in y around 0 99.4%
mul-1-neg99.4%
sub-neg99.4%
metadata-eval99.4%
distribute-rgt-neg-in99.4%
mul-1-neg99.4%
+-commutative99.4%
distribute-lft-in99.4%
metadata-eval99.4%
neg-mul-199.4%
unsub-neg99.4%
Simplified99.4%
Taylor expanded in z around inf 46.0%
mul-1-neg46.0%
distribute-rgt-neg-in46.0%
Simplified46.0%
Final simplification46.0%
(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.2%
sub-neg91.2%
+-commutative91.2%
associate-+l+91.2%
fma-def91.2%
sub-neg91.2%
metadata-eval91.2%
sub-neg91.2%
log1p-def99.9%
sub-neg99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 37.5%
neg-mul-137.5%
Simplified37.5%
Final simplification37.5%
herbie shell --seed 2023318
(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))