
(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 16 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 86.9%
+-commutative86.9%
fma-def86.9%
sub-neg86.9%
metadata-eval86.9%
sub-neg86.9%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (fma y (- 1.0 z) (* (log y) (+ -1.0 x))) t))
double code(double x, double y, double z, double t) {
return fma(y, (1.0 - z), (log(y) * (-1.0 + x))) - t;
}
function code(x, y, z, t) return Float64(fma(y, Float64(1.0 - z), Float64(log(y) * Float64(-1.0 + x))) - t) end
code[x_, y_, z_, t_] := N[(N[(y * N[(1.0 - z), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 1 - z, \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Initial program 86.9%
Taylor expanded in y around 0 99.5%
+-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
*-commutative99.5%
mul-1-neg99.5%
unsub-neg99.5%
*-commutative99.5%
+-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in y around 0 99.5%
fma-def99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (+ z -1.0))))
(if (or (<= (+ -1.0 x) -4000000.0) (not (<= (+ -1.0 x) -0.5)))
(- (- (* x (log y)) t_1) t)
(- (- (- (log y)) t_1) t))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z + -1.0);
double tmp;
if (((-1.0 + x) <= -4000000.0) || !((-1.0 + x) <= -0.5)) {
tmp = ((x * log(y)) - t_1) - t;
} else {
tmp = (-log(y) - t_1) - 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 * (z + (-1.0d0))
if ((((-1.0d0) + x) <= (-4000000.0d0)) .or. (.not. (((-1.0d0) + x) <= (-0.5d0)))) then
tmp = ((x * log(y)) - t_1) - t
else
tmp = (-log(y) - t_1) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (z + -1.0);
double tmp;
if (((-1.0 + x) <= -4000000.0) || !((-1.0 + x) <= -0.5)) {
tmp = ((x * Math.log(y)) - t_1) - t;
} else {
tmp = (-Math.log(y) - t_1) - t;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z + -1.0) tmp = 0 if ((-1.0 + x) <= -4000000.0) or not ((-1.0 + x) <= -0.5): tmp = ((x * math.log(y)) - t_1) - t else: tmp = (-math.log(y) - t_1) - t return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z + -1.0)) tmp = 0.0 if ((Float64(-1.0 + x) <= -4000000.0) || !(Float64(-1.0 + x) <= -0.5)) tmp = Float64(Float64(Float64(x * log(y)) - t_1) - t); else tmp = Float64(Float64(Float64(-log(y)) - t_1) - t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z + -1.0); tmp = 0.0; if (((-1.0 + x) <= -4000000.0) || ~(((-1.0 + x) <= -0.5))) tmp = ((x * log(y)) - t_1) - t; else tmp = (-log(y) - t_1) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[N[(-1.0 + x), $MachinePrecision], -4000000.0], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], -0.5]], $MachinePrecision]], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] - t), $MachinePrecision], N[(N[((-N[Log[y], $MachinePrecision]) - t$95$1), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(z + -1\right)\\
\mathbf{if}\;-1 + x \leq -4000000 \lor \neg \left(-1 + x \leq -0.5\right):\\
\;\;\;\;\left(x \cdot \log y - t_1\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-\log y\right) - t_1\right) - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -4e6 or -0.5 < (-.f64 x 1) Initial program 91.7%
Taylor expanded in y around 0 99.7%
+-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
*-commutative99.7%
mul-1-neg99.7%
unsub-neg99.7%
*-commutative99.7%
+-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 98.9%
*-commutative98.9%
Simplified98.9%
if -4e6 < (-.f64 x 1) < -0.5Initial program 81.8%
Taylor expanded in y around 0 99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
*-commutative99.2%
mul-1-neg99.2%
unsub-neg99.2%
*-commutative99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in x around 0 98.1%
neg-mul-198.1%
Simplified98.1%
Final simplification98.5%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ -1.0 x) -320000.0) (not (<= (+ -1.0 x) 8e+18))) (- (* (log y) (+ -1.0 x)) t) (- (- (- (log y)) (* y (+ z -1.0))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -320000.0) || !((-1.0 + x) <= 8e+18)) {
tmp = (log(y) * (-1.0 + x)) - t;
} else {
tmp = (-log(y) - (y * (z + -1.0))) - 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) <= (-320000.0d0)) .or. (.not. (((-1.0d0) + x) <= 8d+18))) then
tmp = (log(y) * ((-1.0d0) + x)) - t
else
tmp = (-log(y) - (y * (z + (-1.0d0)))) - 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) <= -320000.0) || !((-1.0 + x) <= 8e+18)) {
tmp = (Math.log(y) * (-1.0 + x)) - t;
} else {
tmp = (-Math.log(y) - (y * (z + -1.0))) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((-1.0 + x) <= -320000.0) or not ((-1.0 + x) <= 8e+18): tmp = (math.log(y) * (-1.0 + x)) - t else: tmp = (-math.log(y) - (y * (z + -1.0))) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(-1.0 + x) <= -320000.0) || !(Float64(-1.0 + x) <= 8e+18)) tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); else tmp = Float64(Float64(Float64(-log(y)) - Float64(y * Float64(z + -1.0))) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((-1.0 + x) <= -320000.0) || ~(((-1.0 + x) <= 8e+18))) tmp = (log(y) * (-1.0 + x)) - t; else tmp = (-log(y) - (y * (z + -1.0))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(-1.0 + x), $MachinePrecision], -320000.0], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], 8e+18]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[((-N[Log[y], $MachinePrecision]) - N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -320000 \lor \neg \left(-1 + x \leq 8 \cdot 10^{+18}\right):\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-\log y\right) - y \cdot \left(z + -1\right)\right) - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -3.2e5 or 8e18 < (-.f64 x 1) Initial program 92.9%
+-commutative92.9%
fma-def92.9%
sub-neg92.9%
metadata-eval92.9%
sub-neg92.9%
log1p-def99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 92.8%
if -3.2e5 < (-.f64 x 1) < 8e18Initial program 80.7%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
*-commutative99.3%
mul-1-neg99.3%
unsub-neg99.3%
*-commutative99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in x around 0 97.4%
neg-mul-197.4%
Simplified97.4%
Final simplification95.1%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ -1.0 x) -320000.0) (not (<= (+ -1.0 x) 6.4e+18))) (- (* (log y) (+ -1.0 x)) t) (- (- (- (log y)) (* z y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -320000.0) || !((-1.0 + x) <= 6.4e+18)) {
tmp = (log(y) * (-1.0 + x)) - t;
} else {
tmp = (-log(y) - (z * 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) <= (-320000.0d0)) .or. (.not. (((-1.0d0) + x) <= 6.4d+18))) then
tmp = (log(y) * ((-1.0d0) + x)) - t
else
tmp = (-log(y) - (z * 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) <= -320000.0) || !((-1.0 + x) <= 6.4e+18)) {
tmp = (Math.log(y) * (-1.0 + x)) - t;
} else {
tmp = (-Math.log(y) - (z * y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((-1.0 + x) <= -320000.0) or not ((-1.0 + x) <= 6.4e+18): tmp = (math.log(y) * (-1.0 + x)) - t else: tmp = (-math.log(y) - (z * y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(-1.0 + x) <= -320000.0) || !(Float64(-1.0 + x) <= 6.4e+18)) tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); else tmp = Float64(Float64(Float64(-log(y)) - Float64(z * y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((-1.0 + x) <= -320000.0) || ~(((-1.0 + x) <= 6.4e+18))) tmp = (log(y) * (-1.0 + x)) - t; else tmp = (-log(y) - (z * y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(-1.0 + x), $MachinePrecision], -320000.0], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], 6.4e+18]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[((-N[Log[y], $MachinePrecision]) - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -320000 \lor \neg \left(-1 + x \leq 6.4 \cdot 10^{+18}\right):\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-\log y\right) - z \cdot y\right) - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -3.2e5 or 6.4e18 < (-.f64 x 1) Initial program 92.9%
+-commutative92.9%
fma-def92.9%
sub-neg92.9%
metadata-eval92.9%
sub-neg92.9%
log1p-def99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 92.8%
if -3.2e5 < (-.f64 x 1) < 6.4e18Initial program 80.7%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
*-commutative99.3%
mul-1-neg99.3%
unsub-neg99.3%
*-commutative99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in x around 0 97.4%
neg-mul-197.4%
Simplified97.4%
Taylor expanded in z around inf 97.2%
Final simplification95.0%
(FPCore (x y z t) :precision binary64 (- (- (* y (- (- -1.0) z)) (* (log (/ 1.0 y)) (+ -1.0 x))) t))
double code(double x, double y, double z, double t) {
return ((y * (-(-1.0) - z)) - (log((1.0 / 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((1.0d0 / 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((1.0 / y)) * (-1.0 + x))) - t;
}
def code(x, y, z, t): return ((y * (-(-1.0) - z)) - (math.log((1.0 / y)) * (-1.0 + x))) - t
function code(x, y, z, t) return Float64(Float64(Float64(y * Float64(Float64(-(-1.0)) - z)) - Float64(log(Float64(1.0 / y)) * Float64(-1.0 + x))) - t) end
function tmp = code(x, y, z, t) tmp = ((y * (-(-1.0) - z)) - (log((1.0 / y)) * (-1.0 + x))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(y * N[((--1.0) - z), $MachinePrecision]), $MachinePrecision] - N[(N[Log[N[(1.0 / y), $MachinePrecision]], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(y \cdot \left(\left(--1\right) - z\right) - \log \left(\frac{1}{y}\right) \cdot \left(-1 + x\right)\right) - t
\end{array}
Initial program 86.9%
Taylor expanded in y around 0 99.5%
+-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
*-commutative99.5%
mul-1-neg99.5%
unsub-neg99.5%
*-commutative99.5%
+-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in y around inf 99.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (- (- (* (log y) (+ -1.0 x)) (* y (+ z -1.0))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) - (y * (z + -1.0))) - 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)) - (y * (z + (-1.0d0)))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (-1.0 + x)) - (y * (z + -1.0))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) - (y * (z + -1.0))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) - Float64(y * Float64(z + -1.0))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (-1.0 + x)) - (y * (z + -1.0))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(-1 + x\right) - y \cdot \left(z + -1\right)\right) - t
\end{array}
Initial program 86.9%
Taylor expanded in y around 0 99.5%
+-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
*-commutative99.5%
mul-1-neg99.5%
unsub-neg99.5%
*-commutative99.5%
+-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
+-commutative99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2e+127) (not (<= z 2.95e+19))) (- (* z (log1p (- y))) t) (- (- y (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2e+127) || !(z <= 2.95e+19)) {
tmp = (z * log1p(-y)) - t;
} else {
tmp = (y - log(y)) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2e+127) || !(z <= 2.95e+19)) {
tmp = (z * Math.log1p(-y)) - t;
} else {
tmp = (y - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2e+127) or not (z <= 2.95e+19): tmp = (z * math.log1p(-y)) - t else: tmp = (y - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2e+127) || !(z <= 2.95e+19)) tmp = Float64(Float64(z * log1p(Float64(-y))) - t); else tmp = Float64(Float64(y - log(y)) - t); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2e+127], N[Not[LessEqual[z, 2.95e+19]], $MachinePrecision]], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+127} \lor \neg \left(z \leq 2.95 \cdot 10^{+19}\right):\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(y - \log y\right) - t\\
\end{array}
\end{array}
if z < -1.99999999999999991e127 or 2.95e19 < z Initial program 66.8%
Taylor expanded in z around inf 32.1%
*-commutative32.1%
sub-neg32.1%
mul-1-neg32.1%
log1p-def63.6%
mul-1-neg63.6%
Simplified63.6%
if -1.99999999999999991e127 < z < 2.95e19Initial program 99.1%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
mul-1-neg99.4%
unsub-neg99.4%
*-commutative99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in x around 0 62.4%
neg-mul-162.4%
Simplified62.4%
Taylor expanded in z around 0 61.7%
mul-1-neg61.7%
+-commutative61.7%
*-commutative61.7%
distribute-neg-in61.7%
distribute-rgt-neg-in61.7%
metadata-eval61.7%
*-rgt-identity61.7%
unsub-neg61.7%
Simplified61.7%
Final simplification62.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -260.0) (not (<= t 350.0))) (- (* z (- y)) t) (- (- (log y)) (* z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -260.0) || !(t <= 350.0)) {
tmp = (z * -y) - t;
} else {
tmp = -log(y) - (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 <= (-260.0d0)) .or. (.not. (t <= 350.0d0))) then
tmp = (z * -y) - t
else
tmp = -log(y) - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -260.0) || !(t <= 350.0)) {
tmp = (z * -y) - t;
} else {
tmp = -Math.log(y) - (z * y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -260.0) or not (t <= 350.0): tmp = (z * -y) - t else: tmp = -math.log(y) - (z * y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -260.0) || !(t <= 350.0)) tmp = Float64(Float64(z * Float64(-y)) - t); else tmp = Float64(Float64(-log(y)) - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -260.0) || ~((t <= 350.0))) tmp = (z * -y) - t; else tmp = -log(y) - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -260.0], N[Not[LessEqual[t, 350.0]], $MachinePrecision]], N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision], N[((-N[Log[y], $MachinePrecision]) - N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -260 \lor \neg \left(t \leq 350\right):\\
\;\;\;\;z \cdot \left(-y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-\log y\right) - z \cdot y\\
\end{array}
\end{array}
if t < -260 or 350 < t Initial program 93.2%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
*-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in z around inf 80.9%
mul-1-neg80.9%
distribute-rgt-neg-in80.9%
Simplified80.9%
if -260 < t < 350Initial program 81.6%
Taylor expanded in y around 0 99.1%
+-commutative99.1%
sub-neg99.1%
metadata-eval99.1%
*-commutative99.1%
mul-1-neg99.1%
unsub-neg99.1%
*-commutative99.1%
+-commutative99.1%
sub-neg99.1%
metadata-eval99.1%
+-commutative99.1%
Simplified99.1%
Taylor expanded in x around 0 52.3%
neg-mul-152.3%
Simplified52.3%
Taylor expanded in z around inf 52.2%
Taylor expanded in t around 0 51.5%
Final simplification64.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6e+127) (not (<= z 2.95e+19))) (- (* z (- y)) t) (- (- y (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6e+127) || !(z <= 2.95e+19)) {
tmp = (z * -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 ((z <= (-6d+127)) .or. (.not. (z <= 2.95d+19))) then
tmp = (z * -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 ((z <= -6e+127) || !(z <= 2.95e+19)) {
tmp = (z * -y) - t;
} else {
tmp = (y - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6e+127) or not (z <= 2.95e+19): tmp = (z * -y) - t else: tmp = (y - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6e+127) || !(z <= 2.95e+19)) tmp = Float64(Float64(z * Float64(-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 ((z <= -6e+127) || ~((z <= 2.95e+19))) tmp = (z * -y) - t; else tmp = (y - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6e+127], N[Not[LessEqual[z, 2.95e+19]], $MachinePrecision]], N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision], N[(N[(y - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+127} \lor \neg \left(z \leq 2.95 \cdot 10^{+19}\right):\\
\;\;\;\;z \cdot \left(-y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(y - \log y\right) - t\\
\end{array}
\end{array}
if z < -6.0000000000000005e127 or 2.95e19 < z Initial program 66.8%
Taylor expanded in y around 0 99.7%
+-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
*-commutative99.7%
mul-1-neg99.7%
unsub-neg99.7%
*-commutative99.7%
+-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in z around inf 63.4%
mul-1-neg63.4%
distribute-rgt-neg-in63.4%
Simplified63.4%
if -6.0000000000000005e127 < z < 2.95e19Initial program 99.1%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
mul-1-neg99.4%
unsub-neg99.4%
*-commutative99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in x around 0 62.4%
neg-mul-162.4%
Simplified62.4%
Taylor expanded in z around 0 61.7%
mul-1-neg61.7%
+-commutative61.7%
*-commutative61.7%
distribute-neg-in61.7%
distribute-rgt-neg-in61.7%
metadata-eval61.7%
*-rgt-identity61.7%
unsub-neg61.7%
Simplified61.7%
Final simplification62.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.5e+130) (not (<= z 2.95e+19))) (- (* z (- y)) t) (- (+ (log y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.5e+130) || !(z <= 2.95e+19)) {
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 <= (-7.5d+130)) .or. (.not. (z <= 2.95d+19))) 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 <= -7.5e+130) || !(z <= 2.95e+19)) {
tmp = (z * -y) - t;
} else {
tmp = -(Math.log(y) + t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.5e+130) or not (z <= 2.95e+19): tmp = (z * -y) - t else: tmp = -(math.log(y) + t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.5e+130) || !(z <= 2.95e+19)) 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 <= -7.5e+130) || ~((z <= 2.95e+19))) tmp = (z * -y) - t; else tmp = -(log(y) + t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.5e+130], N[Not[LessEqual[z, 2.95e+19]], $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 -7.5 \cdot 10^{+130} \lor \neg \left(z \leq 2.95 \cdot 10^{+19}\right):\\
\;\;\;\;z \cdot \left(-y\right) - t\\
\mathbf{else}:\\
\;\;\;\;-\left(\log y + t\right)\\
\end{array}
\end{array}
if z < -7.5000000000000003e130 or 2.95e19 < z Initial program 66.8%
Taylor expanded in y around 0 99.7%
+-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
*-commutative99.7%
mul-1-neg99.7%
unsub-neg99.7%
*-commutative99.7%
+-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in z around inf 63.4%
mul-1-neg63.4%
distribute-rgt-neg-in63.4%
Simplified63.4%
if -7.5000000000000003e130 < z < 2.95e19Initial program 99.1%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
mul-1-neg99.4%
unsub-neg99.4%
*-commutative99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in x around 0 62.4%
neg-mul-162.4%
Simplified62.4%
Taylor expanded in y around 0 61.6%
mul-1-neg61.6%
distribute-neg-in61.6%
unsub-neg61.6%
Simplified61.6%
Final simplification62.3%
(FPCore (x y z t) :precision binary64 (- (* (log y) (+ -1.0 x)) t))
double code(double x, double y, double z, double t) {
return (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 = (log(y) * ((-1.0d0) + x)) - t
end function
public static double code(double x, double y, double z, double t) {
return (Math.log(y) * (-1.0 + x)) - t;
}
def code(x, y, z, t): return (math.log(y) * (-1.0 + x)) - t
function code(x, y, z, t) return Float64(Float64(log(y) * Float64(-1.0 + x)) - t) end
function tmp = code(x, y, z, t) tmp = (log(y) * (-1.0 + x)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\log y \cdot \left(-1 + x\right) - t
\end{array}
Initial program 86.9%
+-commutative86.9%
fma-def86.9%
sub-neg86.9%
metadata-eval86.9%
sub-neg86.9%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 86.2%
Final simplification86.2%
(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 86.9%
Taylor expanded in y around 0 99.5%
+-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
*-commutative99.5%
mul-1-neg99.5%
unsub-neg99.5%
*-commutative99.5%
+-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in y around inf 48.1%
Final simplification48.1%
(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 86.9%
Taylor expanded in y around 0 99.5%
+-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
*-commutative99.5%
mul-1-neg99.5%
unsub-neg99.5%
*-commutative99.5%
+-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in z around inf 47.8%
mul-1-neg47.8%
distribute-rgt-neg-in47.8%
Simplified47.8%
Final simplification47.8%
(FPCore (x y z t) :precision binary64 (- y t))
double code(double x, double y, double z, double t) {
return 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 = y - t
end function
public static double code(double x, double y, double z, double t) {
return y - t;
}
def code(x, y, z, t): return y - t
function code(x, y, z, t) return Float64(y - t) end
function tmp = code(x, y, z, t) tmp = y - t; end
code[x_, y_, z_, t_] := N[(y - t), $MachinePrecision]
\begin{array}{l}
\\
y - t
\end{array}
Initial program 86.9%
Taylor expanded in y around 0 99.5%
+-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
*-commutative99.5%
mul-1-neg99.5%
unsub-neg99.5%
*-commutative99.5%
+-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in y around inf 48.1%
Taylor expanded in z around 0 35.6%
Final simplification35.6%
(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 86.9%
+-commutative86.9%
fma-def86.9%
sub-neg86.9%
metadata-eval86.9%
sub-neg86.9%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in t around inf 35.3%
neg-mul-135.3%
Simplified35.3%
Final simplification35.3%
herbie shell --seed 2023321
(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))