
(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 15 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)) (- (* (+ x -1.0) (log y)) t)))
double code(double x, double y, double z, double t) {
return fma((z + -1.0), log1p(-y), (((x + -1.0) * log(y)) - t));
}
function code(x, y, z, t) return fma(Float64(z + -1.0), log1p(Float64(-y)), Float64(Float64(Float64(x + -1.0) * log(y)) - t)) end
code[x_, y_, z_, t_] := N[(N[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y - t\right)
\end{array}
Initial program 88.3%
+-commutative88.3%
associate--l+88.3%
fma-def88.3%
sub-neg88.3%
log1p-def99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ x -1.0) (log y)) (* z (log1p (- y)))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + (z * log1p(-y))) - t;
}
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) + (z * Math.log1p(-y))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + (z * math.log1p(-y))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(z * log1p(Float64(-y)))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + z \cdot \mathsf{log1p}\left(-y\right)\right) - t
\end{array}
Initial program 88.3%
Taylor expanded in z around inf 88.0%
*-commutative88.0%
sub-neg88.0%
mul-1-neg88.0%
log1p-def99.6%
mul-1-neg99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ x -1.0) (log y)) (* (+ z -1.0) (- (* y (* y -0.5)) y))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + ((z + -1.0) * ((y * (y * -0.5)) - 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)) * ((y * (y * (-0.5d0))) - 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) * ((y * (y * -0.5)) - y))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + ((z + -1.0) * ((y * (y * -0.5)) - y))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(Float64(z + -1.0) * Float64(Float64(y * Float64(y * -0.5)) - y))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + ((z + -1.0) * ((y * (y * -0.5)) - 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[(N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + \left(z + -1\right) \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right)\right) - t
\end{array}
Initial program 88.3%
Taylor expanded in y around 0 99.4%
mul-1-neg99.4%
unsub-neg99.4%
*-commutative99.4%
unpow299.4%
associate-*l*99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x y z t)
:precision binary64
(if (<= (+ x -1.0) -2e+53)
(- (* x (log y)) t)
(if (<= (+ x -1.0) -0.004)
(- (- (- y (* z y)) (log y)) t)
(- (* (+ x -1.0) (log y)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + -1.0) <= -2e+53) {
tmp = (x * log(y)) - t;
} else if ((x + -1.0) <= -0.004) {
tmp = ((y - (z * y)) - log(y)) - t;
} else {
tmp = ((x + -1.0) * 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 + (-1.0d0)) <= (-2d+53)) then
tmp = (x * log(y)) - t
else if ((x + (-1.0d0)) <= (-0.004d0)) then
tmp = ((y - (z * y)) - log(y)) - t
else
tmp = ((x + (-1.0d0)) * 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 + -1.0) <= -2e+53) {
tmp = (x * Math.log(y)) - t;
} else if ((x + -1.0) <= -0.004) {
tmp = ((y - (z * y)) - Math.log(y)) - t;
} else {
tmp = ((x + -1.0) * Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + -1.0) <= -2e+53: tmp = (x * math.log(y)) - t elif (x + -1.0) <= -0.004: tmp = ((y - (z * y)) - math.log(y)) - t else: tmp = ((x + -1.0) * math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + -1.0) <= -2e+53) tmp = Float64(Float64(x * log(y)) - t); elseif (Float64(x + -1.0) <= -0.004) tmp = Float64(Float64(Float64(y - Float64(z * y)) - log(y)) - t); else tmp = Float64(Float64(Float64(x + -1.0) * log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + -1.0) <= -2e+53) tmp = (x * log(y)) - t; elseif ((x + -1.0) <= -0.004) tmp = ((y - (z * y)) - log(y)) - t; else tmp = ((x + -1.0) * log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + -1.0), $MachinePrecision], -2e+53], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(x + -1.0), $MachinePrecision], -0.004], N[(N[(N[(y - N[(z * y), $MachinePrecision]), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + -1 \leq -2 \cdot 10^{+53}:\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{elif}\;x + -1 \leq -0.004:\\
\;\;\;\;\left(\left(y - z \cdot y\right) - \log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(x + -1\right) \cdot \log y - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -2e53Initial program 93.4%
Taylor expanded in y around 0 99.4%
mul-1-neg99.4%
unsub-neg99.4%
associate-*r*99.4%
*-commutative99.4%
unpow299.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
distribute-lft-in99.4%
metadata-eval99.4%
*-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in x around inf 91.0%
if -2e53 < (-.f64 x 1) < -0.0040000000000000001Initial program 85.4%
Taylor expanded in y around 0 99.3%
mul-1-neg99.3%
Simplified99.3%
Taylor expanded in x around 0 98.1%
mul-1-neg98.1%
Simplified98.1%
Taylor expanded in z around 0 98.1%
+-commutative98.1%
mul-1-neg98.1%
unsub-neg98.1%
Simplified98.1%
if -0.0040000000000000001 < (-.f64 x 1) Initial program 89.9%
+-commutative89.9%
associate--l+89.9%
fma-def89.9%
sub-neg89.9%
log1p-def99.8%
Simplified99.8%
Taylor expanded in y around 0 88.6%
Final simplification94.2%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ x -1.0) (log y)) (* z (- (* y (* y -0.5)) y))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + (z * ((y * (y * -0.5)) - 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 * ((y * (y * (-0.5d0))) - y))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) + (z * ((y * (y * -0.5)) - y))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + (z * ((y * (y * -0.5)) - y))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(z * Float64(Float64(y * Float64(y * -0.5)) - y))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + (z * ((y * (y * -0.5)) - y))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[(N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right)\right) - t
\end{array}
Initial program 88.3%
Taylor expanded in z around inf 88.0%
*-commutative88.0%
sub-neg88.0%
mul-1-neg88.0%
log1p-def99.6%
mul-1-neg99.6%
Simplified99.6%
Taylor expanded in y around 0 99.1%
unpow299.1%
associate-*r*99.1%
associate-*r*99.1%
distribute-rgt-in99.2%
mul-1-neg99.2%
sub-neg99.2%
*-commutative99.2%
associate-*l*99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.0) (not (<= x 0.98))) (- (- (* x (log y)) (* z y)) t) (- (- (- y (* z y)) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.0) || !(x <= 0.98)) {
tmp = ((x * log(y)) - (z * y)) - t;
} else {
tmp = ((y - (z * 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 <= (-1.0d0)) .or. (.not. (x <= 0.98d0))) then
tmp = ((x * log(y)) - (z * y)) - t
else
tmp = ((y - (z * 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 <= -1.0) || !(x <= 0.98)) {
tmp = ((x * Math.log(y)) - (z * y)) - t;
} else {
tmp = ((y - (z * y)) - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.0) or not (x <= 0.98): tmp = ((x * math.log(y)) - (z * y)) - t else: tmp = ((y - (z * y)) - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.0) || !(x <= 0.98)) tmp = Float64(Float64(Float64(x * log(y)) - Float64(z * y)) - t); else tmp = Float64(Float64(Float64(y - Float64(z * y)) - log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.0) || ~((x <= 0.98))) tmp = ((x * log(y)) - (z * y)) - t; else tmp = ((y - (z * y)) - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 0.98]], $MachinePrecision]], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(y - N[(z * y), $MachinePrecision]), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 0.98\right):\\
\;\;\;\;\left(x \cdot \log y - z \cdot y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y - z \cdot y\right) - \log y\right) - t\\
\end{array}
\end{array}
if x < -1 or 0.97999999999999998 < x Initial program 90.0%
Taylor expanded in z around inf 90.0%
*-commutative90.0%
sub-neg90.0%
mul-1-neg90.0%
log1p-def99.7%
mul-1-neg99.7%
Simplified99.7%
Taylor expanded in y around 0 98.6%
associate-*r*98.6%
mul-1-neg98.6%
Simplified98.6%
Taylor expanded in x around inf 97.1%
if -1 < x < 0.97999999999999998Initial program 86.5%
Taylor expanded in y around 0 99.2%
mul-1-neg99.2%
Simplified99.2%
Taylor expanded in x around 0 98.7%
mul-1-neg98.7%
Simplified98.7%
Taylor expanded in z around 0 98.7%
+-commutative98.7%
mul-1-neg98.7%
unsub-neg98.7%
Simplified98.7%
Final simplification97.9%
(FPCore (x y z t) :precision binary64 (- (- (* (+ x -1.0) (log y)) (* (+ z -1.0) y)) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) - ((z + -1.0) * y)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x + (-1.0d0)) * log(y)) - ((z + (-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) * y)) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) - ((z + -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) * y)) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) - ((z + -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] * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y - \left(z + -1\right) \cdot y\right) - t
\end{array}
Initial program 88.3%
Taylor expanded in y around 0 98.9%
mul-1-neg98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x y z t) :precision binary64 (if (<= z -1.1e+185) (- (* z (- y)) t) (if (<= z 4e+284) (- (* (+ x -1.0) (log y)) t) (- (* z (log1p (- y))) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.1e+185) {
tmp = (z * -y) - t;
} else if (z <= 4e+284) {
tmp = ((x + -1.0) * log(y)) - 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.1e+185) {
tmp = (z * -y) - t;
} else if (z <= 4e+284) {
tmp = ((x + -1.0) * Math.log(y)) - t;
} else {
tmp = (z * Math.log1p(-y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.1e+185: tmp = (z * -y) - t elif z <= 4e+284: tmp = ((x + -1.0) * math.log(y)) - t else: tmp = (z * math.log1p(-y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.1e+185) tmp = Float64(Float64(z * Float64(-y)) - t); elseif (z <= 4e+284) tmp = Float64(Float64(Float64(x + -1.0) * log(y)) - t); else tmp = Float64(Float64(z * log1p(Float64(-y))) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.1e+185], N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[z, 4e+284], N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $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.1 \cdot 10^{+185}:\\
\;\;\;\;z \cdot \left(-y\right) - t\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+284}:\\
\;\;\;\;\left(x + -1\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\end{array}
\end{array}
if z < -1.1e185Initial program 39.7%
Taylor expanded in y around 0 100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 92.4%
mul-1-neg92.4%
Simplified92.4%
Taylor expanded in z around inf 92.4%
mul-1-neg92.4%
distribute-rgt-neg-in92.4%
Simplified92.4%
if -1.1e185 < z < 4.00000000000000032e284Initial program 93.1%
+-commutative93.1%
associate--l+93.1%
fma-def93.1%
sub-neg93.1%
log1p-def99.8%
Simplified99.8%
Taylor expanded in y around 0 92.3%
if 4.00000000000000032e284 < z Initial program 55.2%
Taylor expanded in z around inf 55.2%
*-commutative55.2%
sub-neg55.2%
mul-1-neg55.2%
log1p-def100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 90.7%
mul-1-neg74.2%
Simplified90.7%
Taylor expanded in z around inf 44.3%
sub-neg44.3%
log1p-def90.7%
Simplified90.7%
Final simplification92.3%
(FPCore (x y z t) :precision binary64 (- (- (* (+ x -1.0) (log y)) (* z y)) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) - (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 = (((x + (-1.0d0)) * log(y)) - (z * y)) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) - (z * y)) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) - (z * y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) - Float64(z * y)) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) - (z * y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y - z \cdot y\right) - t
\end{array}
Initial program 88.3%
Taylor expanded in z around inf 88.0%
*-commutative88.0%
sub-neg88.0%
mul-1-neg88.0%
log1p-def99.6%
mul-1-neg99.6%
Simplified99.6%
Taylor expanded in y around 0 98.7%
associate-*r*98.7%
mul-1-neg98.7%
Simplified98.7%
Final simplification98.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -0.00375) (not (<= x 1.0))) (- (* x (log y)) t) (- (- t) (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.00375) || !(x <= 1.0)) {
tmp = (x * log(y)) - t;
} else {
tmp = -t - log(y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-0.00375d0)) .or. (.not. (x <= 1.0d0))) then
tmp = (x * log(y)) - t
else
tmp = -t - log(y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.00375) || !(x <= 1.0)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = -t - Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -0.00375) or not (x <= 1.0): tmp = (x * math.log(y)) - t else: tmp = -t - math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -0.00375) || !(x <= 1.0)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(-t) - log(y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -0.00375) || ~((x <= 1.0))) tmp = (x * log(y)) - t; else tmp = -t - log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -0.00375], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00375 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \log y\\
\end{array}
\end{array}
if x < -0.0037499999999999999 or 1 < x Initial program 89.9%
Taylor expanded in y around 0 99.2%
mul-1-neg99.2%
unsub-neg99.2%
associate-*r*99.2%
*-commutative99.2%
unpow299.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
distribute-lft-in99.2%
metadata-eval99.2%
*-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in x around inf 86.8%
if -0.0037499999999999999 < x < 1Initial program 86.6%
Taylor expanded in y around 0 99.2%
mul-1-neg99.2%
Simplified99.2%
Taylor expanded in x around 0 98.7%
mul-1-neg98.7%
Simplified98.7%
Taylor expanded in y around 0 84.9%
mul-1-neg84.9%
Simplified84.9%
Final simplification85.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -0.00375) (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.00375) || !(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.00375d0)) .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.00375) || !(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.00375) 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.00375) || !(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.00375) || ~((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.00375], 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.00375 \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.0037499999999999999 or 1 < x Initial program 89.9%
Taylor expanded in y around 0 99.2%
mul-1-neg99.2%
unsub-neg99.2%
associate-*r*99.2%
*-commutative99.2%
unpow299.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
distribute-lft-in99.2%
metadata-eval99.2%
*-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in x around inf 86.8%
if -0.0037499999999999999 < x < 1Initial program 86.6%
Taylor expanded in y around 0 99.2%
mul-1-neg99.2%
Simplified99.2%
Taylor expanded in x around 0 98.7%
mul-1-neg98.7%
Simplified98.7%
Taylor expanded in z around 0 85.3%
Final simplification86.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.8e+171) (not (<= z 8e+132))) (- (* z (- y)) t) (- (- t) (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.8e+171) || !(z <= 8e+132)) {
tmp = (z * -y) - t;
} else {
tmp = -t - log(y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.8d+171)) .or. (.not. (z <= 8d+132))) then
tmp = (z * -y) - t
else
tmp = -t - log(y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.8e+171) || !(z <= 8e+132)) {
tmp = (z * -y) - t;
} else {
tmp = -t - Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.8e+171) or not (z <= 8e+132): tmp = (z * -y) - t else: tmp = -t - math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.8e+171) || !(z <= 8e+132)) tmp = Float64(Float64(z * Float64(-y)) - t); else tmp = Float64(Float64(-t) - log(y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.8e+171) || ~((z <= 8e+132))) tmp = (z * -y) - t; else tmp = -t - log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.8e+171], N[Not[LessEqual[z, 8e+132]], $MachinePrecision]], N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+171} \lor \neg \left(z \leq 8 \cdot 10^{+132}\right):\\
\;\;\;\;z \cdot \left(-y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \log y\\
\end{array}
\end{array}
if z < -1.80000000000000009e171 or 7.99999999999999993e132 < z Initial program 61.2%
Taylor expanded in y around 0 97.2%
mul-1-neg97.2%
Simplified97.2%
Taylor expanded in x around 0 67.4%
mul-1-neg67.4%
Simplified67.4%
Taylor expanded in z around inf 64.0%
mul-1-neg64.0%
distribute-rgt-neg-in64.0%
Simplified64.0%
if -1.80000000000000009e171 < z < 7.99999999999999993e132Initial program 97.1%
Taylor expanded in y around 0 99.4%
mul-1-neg99.4%
Simplified99.4%
Taylor expanded in x around 0 64.1%
mul-1-neg64.1%
Simplified64.1%
Taylor expanded in y around 0 61.1%
mul-1-neg61.1%
Simplified61.1%
Final simplification61.8%
(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 88.3%
Taylor expanded in y around 0 99.4%
mul-1-neg99.4%
unsub-neg99.4%
associate-*r*99.4%
*-commutative99.4%
unpow299.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
distribute-lft-in99.4%
metadata-eval99.4%
*-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in y around inf 46.5%
Taylor expanded in y around 0 46.1%
Final simplification46.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 88.3%
Taylor expanded in y around 0 98.9%
mul-1-neg98.9%
Simplified98.9%
Taylor expanded in x around 0 64.9%
mul-1-neg64.9%
Simplified64.9%
Taylor expanded in z around inf 45.9%
mul-1-neg45.9%
distribute-rgt-neg-in45.9%
Simplified45.9%
Final simplification45.9%
(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 88.3%
+-commutative88.3%
associate--l+88.3%
fma-def88.3%
sub-neg88.3%
log1p-def99.9%
Simplified99.9%
Taylor expanded in t around inf 34.6%
neg-mul-134.6%
Simplified34.6%
Final simplification34.6%
herbie shell --seed 2023187
(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))