
(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 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 89.4%
+-commutative89.4%
fma-def89.4%
sub-neg89.4%
metadata-eval89.4%
sub-neg89.4%
log1p-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (- (+ (- (* x (log y)) (log y)) (* y (- 1.0 z))) t))
double code(double x, double y, double z, double t) {
return (((x * log(y)) - log(y)) + (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 = (((x * log(y)) - log(y)) + (y * (1.0d0 - z))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x * Math.log(y)) - Math.log(y)) + (y * (1.0 - z))) - t;
}
def code(x, y, z, t): return (((x * math.log(y)) - math.log(y)) + (y * (1.0 - z))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * log(y)) - log(y)) + Float64(y * Float64(1.0 - z))) - t) end
function tmp = code(x, y, z, t) tmp = (((x * log(y)) - log(y)) + (y * (1.0 - z))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot \log y - \log y\right) + y \cdot \left(1 - z\right)\right) - t
\end{array}
Initial program 89.4%
Taylor expanded in y around 0 99.0%
mul-1-neg99.0%
distribute-rgt-neg-in99.0%
mul-1-neg99.0%
sub-neg99.0%
metadata-eval99.0%
+-commutative99.0%
distribute-lft-in99.0%
metadata-eval99.0%
neg-mul-199.0%
unsub-neg99.0%
Simplified99.0%
*-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
distribute-lft-in99.0%
Applied egg-rr99.0%
Final simplification99.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ -1.0 x) -1.0) (not (<= (+ -1.0 x) -0.9999995))) (- (* (log y) (+ -1.0 x)) t) (- (- (* y (- 1.0 z)) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -1.0) || !((-1.0 + x) <= -0.9999995)) {
tmp = (log(y) * (-1.0 + x)) - 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) <= (-1.0d0)) .or. (.not. (((-1.0d0) + x) <= (-0.9999995d0)))) then
tmp = (log(y) * ((-1.0d0) + x)) - 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) <= -1.0) || !((-1.0 + x) <= -0.9999995)) {
tmp = (Math.log(y) * (-1.0 + x)) - 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) <= -1.0) or not ((-1.0 + x) <= -0.9999995): tmp = (math.log(y) * (-1.0 + x)) - 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) <= -1.0) || !(Float64(-1.0 + x) <= -0.9999995)) tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - 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) <= -1.0) || ~(((-1.0 + x) <= -0.9999995))) tmp = (log(y) * (-1.0 + x)) - 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], -1.0], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], -0.9999995]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $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 -1 \lor \neg \left(-1 + x \leq -0.9999995\right):\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot \left(1 - z\right) - \log y\right) - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -1 or -0.999999500000000041 < (-.f64 x 1) Initial program 89.5%
flip3--89.4%
log-div89.4%
metadata-eval89.4%
pow389.4%
sub-neg89.4%
distribute-rgt-neg-out89.4%
add-sqr-sqrt0.0%
sqrt-unprod89.4%
sqr-neg89.4%
sqrt-unprod89.4%
add-sqr-sqrt89.4%
log1p-udef89.4%
pow389.4%
metadata-eval89.4%
log1p-udef99.7%
*-un-lft-identity99.7%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 87.7%
if -1 < (-.f64 x 1) < -0.999999500000000041Initial program 84.7%
Taylor expanded in y around 0 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
mul-1-neg100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
distribute-lft-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
neg-mul-1100.0%
log-rec100.0%
+-commutative100.0%
log-rec100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification88.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ -1.0 x) -200.0) (not (<= (+ -1.0 x) -0.5))) (- (- (* x (log y)) (* z 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) <= -200.0) || !((-1.0 + x) <= -0.5)) {
tmp = ((x * log(y)) - (z * 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) <= (-200.0d0)) .or. (.not. (((-1.0d0) + x) <= (-0.5d0)))) then
tmp = ((x * log(y)) - (z * 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) <= -200.0) || !((-1.0 + x) <= -0.5)) {
tmp = ((x * Math.log(y)) - (z * 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) <= -200.0) or not ((-1.0 + x) <= -0.5): tmp = ((x * math.log(y)) - (z * 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) <= -200.0) || !(Float64(-1.0 + x) <= -0.5)) tmp = Float64(Float64(Float64(x * log(y)) - Float64(z * 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) <= -200.0) || ~(((-1.0 + x) <= -0.5))) tmp = ((x * log(y)) - (z * 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], -200.0], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], -0.5]], $MachinePrecision]], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(z * 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 -200 \lor \neg \left(-1 + x \leq -0.5\right):\\
\;\;\;\;\left(x \cdot \log y - z \cdot y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot \left(1 - z\right) - \log y\right) - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -200 or -0.5 < (-.f64 x 1) Initial program 94.5%
Taylor expanded in y around 0 99.1%
mul-1-neg99.1%
distribute-rgt-neg-in99.1%
mul-1-neg99.1%
sub-neg99.1%
metadata-eval99.1%
+-commutative99.1%
distribute-lft-in99.1%
metadata-eval99.1%
neg-mul-199.1%
unsub-neg99.1%
Simplified99.1%
Taylor expanded in x around inf 97.4%
*-commutative97.4%
Simplified97.4%
Taylor expanded in z around inf 97.4%
associate-*r*97.4%
neg-mul-197.4%
Simplified97.4%
if -200 < (-.f64 x 1) < -0.5Initial program 84.8%
Taylor expanded in y around 0 98.8%
mul-1-neg98.8%
distribute-rgt-neg-in98.8%
mul-1-neg98.8%
sub-neg98.8%
metadata-eval98.8%
+-commutative98.8%
distribute-lft-in98.8%
metadata-eval98.8%
neg-mul-198.8%
unsub-neg98.8%
Simplified98.8%
Taylor expanded in x around 0 97.6%
neg-mul-197.6%
log-rec97.6%
+-commutative97.6%
log-rec97.6%
unsub-neg97.6%
Simplified97.6%
Final simplification97.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.9e+202) (not (<= z 1.3e+186))) (- (* z (log1p (- y))) t) (- (* (log y) (+ -1.0 x)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.9e+202) || !(z <= 1.3e+186)) {
tmp = (z * log1p(-y)) - t;
} else {
tmp = (log(y) * (-1.0 + x)) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.9e+202) || !(z <= 1.3e+186)) {
tmp = (z * Math.log1p(-y)) - t;
} else {
tmp = (Math.log(y) * (-1.0 + x)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.9e+202) or not (z <= 1.3e+186): tmp = (z * math.log1p(-y)) - t else: tmp = (math.log(y) * (-1.0 + x)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.9e+202) || !(z <= 1.3e+186)) tmp = Float64(Float64(z * log1p(Float64(-y))) - t); else tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.9e+202], N[Not[LessEqual[z, 1.3e+186]], $MachinePrecision]], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{+202} \lor \neg \left(z \leq 1.3 \cdot 10^{+186}\right):\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\end{array}
\end{array}
if z < -3.89999999999999983e202 or 1.3e186 < z Initial program 55.3%
*-commutative55.3%
sub-neg55.3%
metadata-eval55.3%
flip-+44.3%
associate-*r/44.3%
metadata-eval44.3%
fma-neg44.3%
metadata-eval44.3%
sub-neg44.3%
metadata-eval44.3%
+-commutative44.3%
Applied egg-rr44.3%
associate-/l*44.3%
Simplified44.3%
Taylor expanded in z around inf 42.9%
sub-neg42.9%
log1p-def88.0%
Simplified88.0%
if -3.89999999999999983e202 < z < 1.3e186Initial program 96.5%
flip3--96.3%
log-div96.3%
metadata-eval96.3%
pow396.3%
sub-neg96.3%
distribute-rgt-neg-out96.3%
add-sqr-sqrt0.0%
sqrt-unprod96.3%
sqr-neg96.3%
sqrt-unprod96.3%
add-sqr-sqrt96.3%
log1p-udef96.3%
pow396.3%
metadata-eval96.3%
log1p-udef99.7%
*-un-lft-identity99.7%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 95.3%
Final simplification94.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -0.52) (not (<= x 1.0))) (- (* x (log y)) t) (- (- (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.52) || !(x <= 1.0)) {
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 <= (-0.52d0)) .or. (.not. (x <= 1.0d0))) 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 <= -0.52) || !(x <= 1.0)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = -Math.log(y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -0.52) or not (x <= 1.0): 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 <= -0.52) || !(x <= 1.0)) 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 <= -0.52) || ~((x <= 1.0))) tmp = (x * log(y)) - t; else tmp = -log(y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -0.52], N[Not[LessEqual[x, 1.0]], $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 -0.52 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(-\log y\right) - t\\
\end{array}
\end{array}
if x < -0.52000000000000002 or 1 < x Initial program 94.2%
flip3--94.1%
log-div94.1%
metadata-eval94.1%
pow394.1%
sub-neg94.1%
distribute-rgt-neg-out94.1%
add-sqr-sqrt0.0%
sqrt-unprod94.1%
sqr-neg94.1%
sqrt-unprod94.1%
add-sqr-sqrt94.1%
log1p-udef94.1%
pow394.1%
metadata-eval94.1%
log1p-udef99.7%
*-un-lft-identity99.7%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 91.7%
if -0.52000000000000002 < x < 1Initial program 85.1%
*-commutative85.1%
sub-neg85.1%
metadata-eval85.1%
flip-+85.1%
associate-*r/85.1%
metadata-eval85.1%
fma-neg85.1%
metadata-eval85.1%
sub-neg85.1%
metadata-eval85.1%
+-commutative85.1%
Applied egg-rr85.1%
associate-/l*85.1%
Simplified85.1%
Taylor expanded in y around 0 82.6%
associate-/l*82.6%
unpow282.6%
fma-neg82.6%
metadata-eval82.6%
Simplified82.6%
Taylor expanded in x around 0 81.4%
neg-mul-181.4%
Simplified81.4%
Final simplification86.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -0.52) (not (<= x 1.0))) (- (* x (log y)) t) (- (- y (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.52) || !(x <= 1.0)) {
tmp = (x * log(y)) - t;
} else {
tmp = (y - 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 <= (-0.52d0)) .or. (.not. (x <= 1.0d0))) then
tmp = (x * log(y)) - t
else
tmp = (y - 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 <= -0.52) || !(x <= 1.0)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = (y - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -0.52) or not (x <= 1.0): tmp = (x * math.log(y)) - t else: tmp = (y - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -0.52) || !(x <= 1.0)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(y - log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -0.52) || ~((x <= 1.0))) tmp = (x * log(y)) - t; else tmp = (y - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -0.52], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.52 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(y - \log y\right) - t\\
\end{array}
\end{array}
if x < -0.52000000000000002 or 1 < x Initial program 94.2%
flip3--94.1%
log-div94.1%
metadata-eval94.1%
pow394.1%
sub-neg94.1%
distribute-rgt-neg-out94.1%
add-sqr-sqrt0.0%
sqrt-unprod94.1%
sqr-neg94.1%
sqrt-unprod94.1%
add-sqr-sqrt94.1%
log1p-udef94.1%
pow394.1%
metadata-eval94.1%
log1p-udef99.7%
*-un-lft-identity99.7%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 91.7%
if -0.52000000000000002 < x < 1Initial program 85.1%
Taylor expanded in y around 0 98.8%
mul-1-neg98.8%
distribute-rgt-neg-in98.8%
mul-1-neg98.8%
sub-neg98.8%
metadata-eval98.8%
+-commutative98.8%
distribute-lft-in98.8%
metadata-eval98.8%
neg-mul-198.8%
unsub-neg98.8%
Simplified98.8%
sub-neg98.8%
metadata-eval98.8%
expm1-log1p-u98.4%
Applied egg-rr98.4%
Taylor expanded in x around 0 97.1%
log1p-def97.1%
neg-mul-197.1%
Simplified97.1%
Taylor expanded in z around 0 81.9%
Final simplification86.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.25e+171) (not (<= z 6.5e+20))) (- (* z (- y)) t) (- (- (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.25e+171) || !(z <= 6.5e+20)) {
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 <= (-1.25d+171)) .or. (.not. (z <= 6.5d+20))) 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 <= -1.25e+171) || !(z <= 6.5e+20)) {
tmp = (z * -y) - t;
} else {
tmp = -Math.log(y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.25e+171) or not (z <= 6.5e+20): tmp = (z * -y) - t else: tmp = -math.log(y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.25e+171) || !(z <= 6.5e+20)) 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 <= -1.25e+171) || ~((z <= 6.5e+20))) tmp = (z * -y) - t; else tmp = -log(y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.25e+171], N[Not[LessEqual[z, 6.5e+20]], $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 -1.25 \cdot 10^{+171} \lor \neg \left(z \leq 6.5 \cdot 10^{+20}\right):\\
\;\;\;\;z \cdot \left(-y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-\log y\right) - t\\
\end{array}
\end{array}
if z < -1.2500000000000001e171 or 6.5e20 < z Initial program 68.6%
Taylor expanded in y around 0 97.3%
mul-1-neg97.3%
distribute-rgt-neg-in97.3%
mul-1-neg97.3%
sub-neg97.3%
metadata-eval97.3%
+-commutative97.3%
distribute-lft-in97.3%
metadata-eval97.3%
neg-mul-197.3%
unsub-neg97.3%
Simplified97.3%
Taylor expanded in x around inf 93.7%
*-commutative93.7%
Simplified93.7%
Taylor expanded in z around inf 71.8%
mul-1-neg71.8%
distribute-rgt-neg-in71.8%
Simplified71.8%
if -1.2500000000000001e171 < z < 6.5e20Initial program 99.1%
*-commutative99.1%
sub-neg99.1%
metadata-eval99.1%
flip-+75.7%
associate-*r/75.7%
metadata-eval75.7%
fma-neg75.7%
metadata-eval75.7%
sub-neg75.7%
metadata-eval75.7%
+-commutative75.7%
Applied egg-rr75.7%
associate-/l*75.7%
Simplified75.7%
Taylor expanded in y around 0 75.2%
associate-/l*75.2%
unpow275.2%
fma-neg75.2%
metadata-eval75.2%
Simplified75.2%
Taylor expanded in x around 0 64.1%
neg-mul-164.1%
Simplified64.1%
Final simplification66.5%
(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 89.4%
Taylor expanded in y around 0 99.0%
mul-1-neg99.0%
distribute-rgt-neg-in99.0%
mul-1-neg99.0%
sub-neg99.0%
metadata-eval99.0%
+-commutative99.0%
distribute-lft-in99.0%
metadata-eval99.0%
neg-mul-199.0%
unsub-neg99.0%
Simplified99.0%
Final simplification99.0%
(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 89.4%
Taylor expanded in y around 0 99.0%
mul-1-neg99.0%
distribute-rgt-neg-in99.0%
mul-1-neg99.0%
sub-neg99.0%
metadata-eval99.0%
+-commutative99.0%
distribute-lft-in99.0%
metadata-eval99.0%
neg-mul-199.0%
unsub-neg99.0%
Simplified99.0%
Taylor expanded in z around inf 98.7%
associate-*r*81.9%
neg-mul-181.9%
Simplified98.7%
Final simplification98.7%
(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 89.4%
*-commutative89.4%
sub-neg89.4%
metadata-eval89.4%
flip-+67.2%
associate-*r/67.2%
metadata-eval67.2%
fma-neg67.2%
metadata-eval67.2%
sub-neg67.2%
metadata-eval67.2%
+-commutative67.2%
Applied egg-rr67.2%
associate-/l*67.2%
Simplified67.2%
div-inv67.2%
fma-def67.2%
clear-num67.2%
metadata-eval67.2%
fma-neg67.2%
metadata-eval67.2%
+-commutative67.2%
flip--89.4%
sub-neg89.4%
metadata-eval89.4%
sub-neg89.4%
metadata-eval89.4%
sub-neg89.4%
log1p-def99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 99.0%
mul-1-neg99.0%
distribute-rgt-neg-in99.0%
sub-neg99.0%
metadata-eval99.0%
+-commutative99.0%
distribute-neg-in99.0%
metadata-eval99.0%
sub-neg99.0%
Simplified99.0%
Taylor expanded in y around inf 52.6%
Final simplification52.6%
(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 89.4%
Taylor expanded in y around 0 99.0%
mul-1-neg99.0%
distribute-rgt-neg-in99.0%
mul-1-neg99.0%
sub-neg99.0%
metadata-eval99.0%
+-commutative99.0%
distribute-lft-in99.0%
metadata-eval99.0%
neg-mul-199.0%
unsub-neg99.0%
Simplified99.0%
Taylor expanded in x around inf 82.0%
*-commutative82.0%
Simplified82.0%
Taylor expanded in z around inf 52.4%
mul-1-neg52.4%
distribute-rgt-neg-in52.4%
Simplified52.4%
Final simplification52.4%
(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 89.4%
flip3--89.3%
log-div89.2%
metadata-eval89.2%
pow389.2%
sub-neg89.2%
distribute-rgt-neg-out89.2%
add-sqr-sqrt0.0%
sqrt-unprod89.3%
sqr-neg89.3%
sqrt-unprod89.3%
add-sqr-sqrt89.3%
log1p-udef89.2%
pow389.2%
metadata-eval89.2%
log1p-udef99.7%
*-un-lft-identity99.7%
fma-def99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 71.3%
Taylor expanded in x around 0 41.7%
neg-mul-141.7%
Simplified41.7%
Final simplification41.7%
herbie shell --seed 2024019
(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))