
(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 (+ x -1.0) (log y) (fma (+ -1.0 z) (log1p (- y)) (- t))))
double code(double x, double y, double z, double t) {
return fma((x + -1.0), log(y), fma((-1.0 + z), log1p(-y), -t));
}
function code(x, y, z, t) return fma(Float64(x + -1.0), log(y), fma(Float64(-1.0 + z), log1p(Float64(-y)), Float64(-t))) end
code[x_, y_, z_, t_] := N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[(-1.0 + z), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x + -1, \log y, \mathsf{fma}\left(-1 + z, \mathsf{log1p}\left(-y\right), -t\right)\right)
\end{array}
Initial program 91.1%
associate--l+91.1%
fma-def91.2%
sub-neg91.2%
metadata-eval91.2%
fma-neg91.2%
sub-neg91.2%
metadata-eval91.2%
sub-neg91.2%
log1p-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (fma (+ -1.0 z) (log1p (- y)) (* (+ x -1.0) (log y))) t))
double code(double x, double y, double z, double t) {
return fma((-1.0 + z), log1p(-y), ((x + -1.0) * log(y))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(-1.0 + z), log1p(Float64(-y)), Float64(Float64(x + -1.0) * log(y))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(-1.0 + z), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-1 + z, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y\right) - t
\end{array}
Initial program 91.1%
+-commutative91.1%
fma-def91.1%
sub-neg91.1%
metadata-eval91.1%
sub-neg91.1%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (+ (fma -1.0 (* y (+ -1.0 z)) (* -0.5 (* (+ -1.0 z) (* y y)))) (* (+ x -1.0) (log y))) t))
double code(double x, double y, double z, double t) {
return (fma(-1.0, (y * (-1.0 + z)), (-0.5 * ((-1.0 + z) * (y * y)))) + ((x + -1.0) * log(y))) - t;
}
function code(x, y, z, t) return Float64(Float64(fma(-1.0, Float64(y * Float64(-1.0 + z)), Float64(-0.5 * Float64(Float64(-1.0 + z) * Float64(y * y)))) + Float64(Float64(x + -1.0) * log(y))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(-1.0 * N[(y * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(N[(-1.0 + z), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\mathsf{fma}\left(-1, y \cdot \left(-1 + z\right), -0.5 \cdot \left(\left(-1 + z\right) \cdot \left(y \cdot y\right)\right)\right) + \left(x + -1\right) \cdot \log y\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 98.9%
fma-def98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
unpow298.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x y z t) :precision binary64 (- (fma y (- 1.0 z) (* (+ x -1.0) (log y))) t))
double code(double x, double y, double z, double t) {
return fma(y, (1.0 - z), ((x + -1.0) * log(y))) - t;
}
function code(x, y, z, t) return Float64(fma(y, Float64(1.0 - z), Float64(Float64(x + -1.0) * log(y))) - t) end
code[x_, y_, z_, t_] := N[(N[(y * N[(1.0 - z), $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 1 - z, \left(x + -1\right) \cdot \log y\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 98.9%
fma-def98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
unpow298.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in y around 0 98.4%
+-commutative98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
fma-def98.4%
mul-1-neg98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
fma-neg98.4%
distribute-rgt-in98.4%
neg-mul-198.4%
+-commutative98.4%
unsub-neg98.4%
*-commutative98.4%
Simplified98.4%
Taylor expanded in y around 0 98.4%
+-commutative98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
associate--l+98.4%
*-lft-identity98.4%
+-commutative98.4%
metadata-eval98.4%
sub-neg98.4%
metadata-eval98.4%
associate-*r*98.4%
associate-*r*98.4%
mul-1-neg98.4%
log-rec98.4%
associate--l+98.4%
+-commutative98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t)
:precision binary64
(if (<= (+ x -1.0) -4e+18)
(- (* x (log y)) t)
(if (<= (+ x -1.0) -0.999999999)
(- (- (- y (log y)) (* y z)) t)
(- (* (+ x -1.0) (log y)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + -1.0) <= -4e+18) {
tmp = (x * log(y)) - t;
} else if ((x + -1.0) <= -0.999999999) {
tmp = ((y - log(y)) - (y * z)) - 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)) <= (-4d+18)) then
tmp = (x * log(y)) - t
else if ((x + (-1.0d0)) <= (-0.999999999d0)) then
tmp = ((y - log(y)) - (y * z)) - 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) <= -4e+18) {
tmp = (x * Math.log(y)) - t;
} else if ((x + -1.0) <= -0.999999999) {
tmp = ((y - Math.log(y)) - (y * z)) - t;
} else {
tmp = ((x + -1.0) * Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + -1.0) <= -4e+18: tmp = (x * math.log(y)) - t elif (x + -1.0) <= -0.999999999: tmp = ((y - math.log(y)) - (y * z)) - 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) <= -4e+18) tmp = Float64(Float64(x * log(y)) - t); elseif (Float64(x + -1.0) <= -0.999999999) tmp = Float64(Float64(Float64(y - log(y)) - Float64(y * z)) - 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) <= -4e+18) tmp = (x * log(y)) - t; elseif ((x + -1.0) <= -0.999999999) tmp = ((y - log(y)) - (y * z)) - 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], -4e+18], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(x + -1.0), $MachinePrecision], -0.999999999], N[(N[(N[(y - N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $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 -4 \cdot 10^{+18}:\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{elif}\;x + -1 \leq -0.999999999:\\
\;\;\;\;\left(\left(y - \log y\right) - y \cdot z\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(x + -1\right) \cdot \log y - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -4e18Initial program 96.2%
Taylor expanded in y around 0 98.7%
fma-def98.7%
sub-neg98.7%
metadata-eval98.7%
+-commutative98.7%
unpow298.7%
sub-neg98.7%
metadata-eval98.7%
+-commutative98.7%
Simplified98.7%
Taylor expanded in x around inf 94.3%
*-commutative94.3%
Simplified94.3%
if -4e18 < (-.f64 x 1) < -0.999999999000000028Initial program 85.3%
Taylor expanded in y around 0 98.5%
fma-def98.5%
sub-neg98.5%
metadata-eval98.5%
+-commutative98.5%
unpow298.5%
sub-neg98.5%
metadata-eval98.5%
+-commutative98.5%
Simplified98.5%
Taylor expanded in y around 0 97.5%
+-commutative97.5%
sub-neg97.5%
metadata-eval97.5%
+-commutative97.5%
fma-def97.5%
mul-1-neg97.5%
sub-neg97.5%
metadata-eval97.5%
+-commutative97.5%
fma-neg97.5%
distribute-rgt-in97.5%
neg-mul-197.5%
+-commutative97.5%
unsub-neg97.5%
*-commutative97.5%
Simplified97.5%
Taylor expanded in x around 0 97.4%
mul-1-neg97.4%
unsub-neg97.4%
Simplified97.4%
if -0.999999999000000028 < (-.f64 x 1) Initial program 96.7%
+-commutative96.7%
fma-def96.7%
sub-neg96.7%
metadata-eval96.7%
sub-neg96.7%
log1p-def99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around 0 96.7%
Final simplification96.5%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ x -1.0) (log y)) (- y (* y z))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + (y - (y * 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 + (-1.0d0)) * log(y)) + (y - (y * z))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) + (y - (y * z))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + (y - (y * z))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(y - Float64(y * z))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + (y - (y * z))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(y - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + \left(y - y \cdot z\right)\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 98.9%
fma-def98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
unpow298.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in y around 0 98.4%
+-commutative98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
fma-def98.4%
mul-1-neg98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
fma-neg98.4%
distribute-rgt-in98.4%
neg-mul-198.4%
+-commutative98.4%
unsub-neg98.4%
*-commutative98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t) :precision binary64 (- (- (* (+ x -1.0) (log y)) (* y z)) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) - (y * 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 + (-1.0d0)) * log(y)) - (y * z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) - (y * z)) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) - (y * z)) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) - Float64(y * z)) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) - (y * z)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y - y \cdot z\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 98.9%
fma-def98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
unpow298.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in y around 0 98.4%
+-commutative98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
fma-def98.4%
mul-1-neg98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
fma-neg98.4%
distribute-rgt-in98.4%
neg-mul-198.4%
+-commutative98.4%
unsub-neg98.4%
*-commutative98.4%
Simplified98.4%
Taylor expanded in z around inf 98.3%
Final simplification98.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.2e+16) (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 <= -7.2e+16) || !(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 <= (-7.2d+16)) .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 <= -7.2e+16) || !(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 <= -7.2e+16) 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 <= -7.2e+16) || !(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 <= -7.2e+16) || ~((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, -7.2e+16], 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 -7.2 \cdot 10^{+16} \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 < -7.2e16 or 1 < x Initial program 96.2%
Taylor expanded in y around 0 99.2%
fma-def99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
unpow299.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in x around inf 94.2%
*-commutative94.2%
Simplified94.2%
if -7.2e16 < x < 1Initial program 86.3%
+-commutative86.3%
fma-def86.3%
sub-neg86.3%
metadata-eval86.3%
sub-neg86.3%
log1p-def100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 83.3%
fma-neg83.3%
sub-neg83.3%
metadata-eval83.3%
+-commutative83.3%
Simplified83.3%
Taylor expanded in x around 0 81.5%
neg-mul-181.5%
Simplified81.5%
Final simplification87.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.2e+16) (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 <= -7.2e+16) || !(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 <= (-7.2d+16)) .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 <= -7.2e+16) || !(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 <= -7.2e+16) 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 <= -7.2e+16) || !(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 <= -7.2e+16) || ~((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, -7.2e+16], 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 -7.2 \cdot 10^{+16} \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 < -7.2e16 or 1 < x Initial program 96.2%
Taylor expanded in y around 0 99.2%
fma-def99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
unpow299.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in x around inf 94.2%
*-commutative94.2%
Simplified94.2%
if -7.2e16 < x < 1Initial program 86.3%
Taylor expanded in y around 0 98.6%
fma-def98.6%
sub-neg98.6%
metadata-eval98.6%
+-commutative98.6%
unpow298.6%
sub-neg98.6%
metadata-eval98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in y around 0 97.7%
+-commutative97.7%
sub-neg97.7%
metadata-eval97.7%
+-commutative97.7%
fma-def97.7%
mul-1-neg97.7%
sub-neg97.7%
metadata-eval97.7%
+-commutative97.7%
fma-neg97.7%
distribute-rgt-in97.7%
neg-mul-197.7%
+-commutative97.7%
unsub-neg97.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in x around 0 95.8%
mul-1-neg95.8%
unsub-neg95.8%
Simplified95.8%
Taylor expanded in z around 0 81.5%
Final simplification87.7%
(FPCore (x y z t) :precision binary64 (if (<= z 2.1e+159) (- (* (+ x -1.0) (log y)) t) (- (- t) (* z (+ y (* (* y y) 0.5))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 2.1e+159) {
tmp = ((x + -1.0) * log(y)) - t;
} else {
tmp = -t - (z * (y + ((y * y) * 0.5)));
}
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 <= 2.1d+159) then
tmp = ((x + (-1.0d0)) * log(y)) - t
else
tmp = -t - (z * (y + ((y * y) * 0.5d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 2.1e+159) {
tmp = ((x + -1.0) * Math.log(y)) - t;
} else {
tmp = -t - (z * (y + ((y * y) * 0.5)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 2.1e+159: tmp = ((x + -1.0) * math.log(y)) - t else: tmp = -t - (z * (y + ((y * y) * 0.5))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 2.1e+159) tmp = Float64(Float64(Float64(x + -1.0) * log(y)) - t); else tmp = Float64(Float64(-t) - Float64(z * Float64(y + Float64(Float64(y * y) * 0.5)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 2.1e+159) tmp = ((x + -1.0) * log(y)) - t; else tmp = -t - (z * (y + ((y * y) * 0.5))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 2.1e+159], N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[(z * N[(y + N[(N[(y * y), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.1 \cdot 10^{+159}:\\
\;\;\;\;\left(x + -1\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - z \cdot \left(y + \left(y \cdot y\right) \cdot 0.5\right)\\
\end{array}
\end{array}
if z < 2.09999999999999989e159Initial program 95.4%
+-commutative95.4%
fma-def95.4%
sub-neg95.4%
metadata-eval95.4%
sub-neg95.4%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 94.1%
if 2.09999999999999989e159 < z Initial program 64.2%
Taylor expanded in y around 0 97.9%
fma-def97.9%
sub-neg97.9%
metadata-eval97.9%
+-commutative97.9%
unpow297.9%
sub-neg97.9%
metadata-eval97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in z around -inf 73.6%
mul-1-neg73.6%
unpow273.6%
Simplified73.6%
Final simplification91.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6e+125) (not (<= z 1.65e+16))) (- (- t) (* z (+ y (* (* y y) 0.5)))) (- (- t) (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6e+125) || !(z <= 1.65e+16)) {
tmp = -t - (z * (y + ((y * y) * 0.5)));
} 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 <= (-6d+125)) .or. (.not. (z <= 1.65d+16))) then
tmp = -t - (z * (y + ((y * y) * 0.5d0)))
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 <= -6e+125) || !(z <= 1.65e+16)) {
tmp = -t - (z * (y + ((y * y) * 0.5)));
} else {
tmp = -t - Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6e+125) or not (z <= 1.65e+16): tmp = -t - (z * (y + ((y * y) * 0.5))) else: tmp = -t - math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6e+125) || !(z <= 1.65e+16)) tmp = Float64(Float64(-t) - Float64(z * Float64(y + Float64(Float64(y * y) * 0.5)))); else tmp = Float64(Float64(-t) - log(y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6e+125) || ~((z <= 1.65e+16))) tmp = -t - (z * (y + ((y * y) * 0.5))); else tmp = -t - log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6e+125], N[Not[LessEqual[z, 1.65e+16]], $MachinePrecision]], N[((-t) - N[(z * N[(y + N[(N[(y * y), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+125} \lor \neg \left(z \leq 1.65 \cdot 10^{+16}\right):\\
\;\;\;\;\left(-t\right) - z \cdot \left(y + \left(y \cdot y\right) \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \log y\\
\end{array}
\end{array}
if z < -6.0000000000000003e125 or 1.65e16 < z Initial program 77.5%
Taylor expanded in y around 0 98.0%
fma-def98.0%
sub-neg98.0%
metadata-eval98.0%
+-commutative98.0%
unpow298.0%
sub-neg98.0%
metadata-eval98.0%
+-commutative98.0%
Simplified98.0%
Taylor expanded in z around -inf 58.6%
mul-1-neg58.6%
unpow258.6%
Simplified58.6%
if -6.0000000000000003e125 < z < 1.65e16Initial program 99.0%
+-commutative99.0%
fma-def99.0%
sub-neg99.0%
metadata-eval99.0%
sub-neg99.0%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 98.3%
fma-neg98.3%
sub-neg98.3%
metadata-eval98.3%
+-commutative98.3%
Simplified98.3%
Taylor expanded in x around 0 61.1%
neg-mul-161.1%
Simplified61.1%
Final simplification60.2%
(FPCore (x y z t) :precision binary64 (- (- t) (* z (+ y (* (* y y) 0.5)))))
double code(double x, double y, double z, double t) {
return -t - (z * (y + ((y * y) * 0.5)));
}
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 - (z * (y + ((y * y) * 0.5d0)))
end function
public static double code(double x, double y, double z, double t) {
return -t - (z * (y + ((y * y) * 0.5)));
}
def code(x, y, z, t): return -t - (z * (y + ((y * y) * 0.5)))
function code(x, y, z, t) return Float64(Float64(-t) - Float64(z * Float64(y + Float64(Float64(y * y) * 0.5)))) end
function tmp = code(x, y, z, t) tmp = -t - (z * (y + ((y * y) * 0.5))); end
code[x_, y_, z_, t_] := N[((-t) - N[(z * N[(y + N[(N[(y * y), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-t\right) - z \cdot \left(y + \left(y \cdot y\right) \cdot 0.5\right)
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 98.9%
fma-def98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
unpow298.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in z around -inf 48.2%
mul-1-neg48.2%
unpow248.2%
Simplified48.2%
Final simplification48.2%
(FPCore (x y z t) :precision binary64 (if (<= t -80.0) (- t) (if (<= t 48000.0) (* y (- 1.0 z)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -80.0) {
tmp = -t;
} else if (t <= 48000.0) {
tmp = y * (1.0 - z);
} 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 <= (-80.0d0)) then
tmp = -t
else if (t <= 48000.0d0) then
tmp = y * (1.0d0 - z)
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 <= -80.0) {
tmp = -t;
} else if (t <= 48000.0) {
tmp = y * (1.0 - z);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -80.0: tmp = -t elif t <= 48000.0: tmp = y * (1.0 - z) else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -80.0) tmp = Float64(-t); elseif (t <= 48000.0) tmp = Float64(y * Float64(1.0 - z)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -80.0) tmp = -t; elseif (t <= 48000.0) tmp = y * (1.0 - z); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -80.0], (-t), If[LessEqual[t, 48000.0], N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -80:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 48000:\\
\;\;\;\;y \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -80 or 48000 < t Initial program 96.9%
+-commutative96.9%
fma-def96.9%
sub-neg96.9%
metadata-eval96.9%
sub-neg96.9%
log1p-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 74.7%
mul-1-neg74.7%
Simplified74.7%
if -80 < t < 48000Initial program 85.2%
Taylor expanded in y around 0 99.2%
fma-def99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
unpow299.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in y around 0 98.4%
+-commutative98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
fma-def98.4%
mul-1-neg98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
fma-neg98.4%
distribute-rgt-in98.4%
neg-mul-198.4%
+-commutative98.4%
unsub-neg98.4%
*-commutative98.4%
Simplified98.4%
Taylor expanded in y around inf 16.9%
Final simplification46.2%
(FPCore (x y z t) :precision binary64 (if (<= t -80.0) (- t) (if (<= t 5500.0) (* y (- z)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -80.0) {
tmp = -t;
} else if (t <= 5500.0) {
tmp = y * -z;
} 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 <= (-80.0d0)) then
tmp = -t
else if (t <= 5500.0d0) then
tmp = y * -z
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 <= -80.0) {
tmp = -t;
} else if (t <= 5500.0) {
tmp = y * -z;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -80.0: tmp = -t elif t <= 5500.0: tmp = y * -z else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -80.0) tmp = Float64(-t); elseif (t <= 5500.0) tmp = Float64(y * Float64(-z)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -80.0) tmp = -t; elseif (t <= 5500.0) tmp = y * -z; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -80.0], (-t), If[LessEqual[t, 5500.0], N[(y * (-z)), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -80:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 5500:\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -80 or 5500 < t Initial program 96.9%
+-commutative96.9%
fma-def96.9%
sub-neg96.9%
metadata-eval96.9%
sub-neg96.9%
log1p-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 74.7%
mul-1-neg74.7%
Simplified74.7%
if -80 < t < 5500Initial program 85.2%
Taylor expanded in y around 0 99.2%
fma-def99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
unpow299.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in y around 0 98.4%
+-commutative98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
fma-def98.4%
mul-1-neg98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
fma-neg98.4%
distribute-rgt-in98.4%
neg-mul-198.4%
+-commutative98.4%
unsub-neg98.4%
*-commutative98.4%
Simplified98.4%
Taylor expanded in z around inf 16.5%
mul-1-neg16.5%
distribute-rgt-neg-in16.5%
Simplified16.5%
Final simplification46.0%
(FPCore (x y z t) :precision binary64 (- (- y (* y z)) t))
double code(double x, double y, double z, double t) {
return (y - (y * 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 - (y * z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (y - (y * z)) - t;
}
def code(x, y, z, t): return (y - (y * z)) - t
function code(x, y, z, t) return Float64(Float64(y - Float64(y * z)) - t) end
function tmp = code(x, y, z, t) tmp = (y - (y * z)) - t; end
code[x_, y_, z_, t_] := N[(N[(y - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(y - y \cdot z\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 98.9%
fma-def98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
unpow298.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in y around 0 98.4%
+-commutative98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
fma-def98.4%
mul-1-neg98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
fma-neg98.4%
distribute-rgt-in98.4%
neg-mul-198.4%
+-commutative98.4%
unsub-neg98.4%
*-commutative98.4%
Simplified98.4%
Taylor expanded in x around 0 62.7%
mul-1-neg62.7%
unsub-neg62.7%
Simplified62.7%
Taylor expanded in y around inf 47.8%
Final simplification47.8%
(FPCore (x y z t) :precision binary64 (- t))
double code(double x, double y, double z, double t) {
return -t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -t
end function
public static double code(double x, double y, double z, double t) {
return -t;
}
def code(x, y, z, t): return -t
function code(x, y, z, t) return Float64(-t) end
function tmp = code(x, y, z, t) tmp = -t; end
code[x_, y_, z_, t_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 91.1%
+-commutative91.1%
fma-def91.1%
sub-neg91.1%
metadata-eval91.1%
sub-neg91.1%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in t around inf 39.3%
mul-1-neg39.3%
Simplified39.3%
Final simplification39.3%
herbie shell --seed 2023279
(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))