
(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)) (* (+ -1.0 x) (log y))) t))
double code(double x, double y, double z, double t) {
return fma((z + -1.0), log1p(-y), ((-1.0 + x) * log(y))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(z + -1.0), log1p(Float64(-y)), Float64(Float64(-1.0 + x) * log(y))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(-1 + x\right) \cdot \log y\right) - t
\end{array}
Initial program 87.9%
+-commutative87.9%
fma-def87.9%
sub-neg87.9%
metadata-eval87.9%
sub-neg87.9%
log1p-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (fma z (log1p (- y)) (- (* (+ -1.0 x) (log y)) t)))
double code(double x, double y, double z, double t) {
return fma(z, log1p(-y), (((-1.0 + x) * log(y)) - t));
}
function code(x, y, z, t) return fma(z, log1p(Float64(-y)), Float64(Float64(Float64(-1.0 + x) * log(y)) - t)) end
code[x_, y_, z_, t_] := N[(z * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, \mathsf{log1p}\left(-y\right), \left(-1 + x\right) \cdot \log y - t\right)
\end{array}
Initial program 87.9%
Taylor expanded in z around inf 87.6%
*-commutative87.6%
sub-neg87.6%
mul-1-neg87.6%
log1p-def99.5%
mul-1-neg99.5%
Simplified99.5%
Taylor expanded in x around 0 87.6%
mul-1-neg87.6%
log-rec87.6%
associate-+r+87.6%
+-commutative87.6%
log-rec87.6%
sub-neg87.6%
*-lft-identity87.6%
distribute-rgt-out--87.6%
+-commutative87.6%
associate--l+87.6%
fma-def87.6%
sub-neg87.6%
log1p-def99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (- (+ (* z (log1p (- y))) (* (+ -1.0 x) (log y))) t))
double code(double x, double y, double z, double t) {
return ((z * log1p(-y)) + ((-1.0 + x) * log(y))) - t;
}
public static double code(double x, double y, double z, double t) {
return ((z * Math.log1p(-y)) + ((-1.0 + x) * Math.log(y))) - t;
}
def code(x, y, z, t): return ((z * math.log1p(-y)) + ((-1.0 + x) * math.log(y))) - t
function code(x, y, z, t) return Float64(Float64(Float64(z * log1p(Float64(-y))) + Float64(Float64(-1.0 + x) * log(y))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(z \cdot \mathsf{log1p}\left(-y\right) + \left(-1 + x\right) \cdot \log y\right) - t
\end{array}
Initial program 87.9%
Taylor expanded in z around inf 87.6%
*-commutative87.6%
sub-neg87.6%
mul-1-neg87.6%
log1p-def99.5%
mul-1-neg99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (- (fma y (- 1.0 z) (* (+ -1.0 x) (log y))) t))
double code(double x, double y, double z, double t) {
return fma(y, (1.0 - z), ((-1.0 + x) * log(y))) - t;
}
function code(x, y, z, t) return Float64(fma(y, Float64(1.0 - z), Float64(Float64(-1.0 + x) * log(y))) - t) end
code[x_, y_, z_, t_] := N[(N[(y * N[(1.0 - z), $MachinePrecision] + N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 1 - z, \left(-1 + x\right) \cdot \log y\right) - t
\end{array}
Initial program 87.9%
*-commutative87.9%
sub-neg87.9%
metadata-eval87.9%
distribute-lft-in87.9%
Applied egg-rr87.9%
distribute-lft-out87.9%
metadata-eval87.9%
sub-neg87.9%
add-sqr-sqrt20.7%
associate-*r*20.7%
sub-neg20.7%
metadata-eval20.7%
sub-neg20.7%
metadata-eval20.7%
Applied egg-rr20.7%
Taylor expanded in y around 0 98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
mul-1-neg98.9%
unsub-neg98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in y around 0 98.9%
fma-def99.0%
sub-neg99.0%
metadata-eval99.0%
Simplified99.0%
Final simplification99.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (- (log y)) t)) (t_2 (- (* x (log y)) t)))
(if (<= x -37000000000.0)
t_2
(if (<= x -5.5e-257)
t_1
(if (<= x 2.4e-275) (- (* y (- 1.0 z)) t) (if (<= x 1e-31) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = -log(y) - t;
double t_2 = (x * log(y)) - t;
double tmp;
if (x <= -37000000000.0) {
tmp = t_2;
} else if (x <= -5.5e-257) {
tmp = t_1;
} else if (x <= 2.4e-275) {
tmp = (y * (1.0 - z)) - t;
} else if (x <= 1e-31) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = -log(y) - t
t_2 = (x * log(y)) - t
if (x <= (-37000000000.0d0)) then
tmp = t_2
else if (x <= (-5.5d-257)) then
tmp = t_1
else if (x <= 2.4d-275) then
tmp = (y * (1.0d0 - z)) - t
else if (x <= 1d-31) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = -Math.log(y) - t;
double t_2 = (x * Math.log(y)) - t;
double tmp;
if (x <= -37000000000.0) {
tmp = t_2;
} else if (x <= -5.5e-257) {
tmp = t_1;
} else if (x <= 2.4e-275) {
tmp = (y * (1.0 - z)) - t;
} else if (x <= 1e-31) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = -math.log(y) - t t_2 = (x * math.log(y)) - t tmp = 0 if x <= -37000000000.0: tmp = t_2 elif x <= -5.5e-257: tmp = t_1 elif x <= 2.4e-275: tmp = (y * (1.0 - z)) - t elif x <= 1e-31: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-log(y)) - t) t_2 = Float64(Float64(x * log(y)) - t) tmp = 0.0 if (x <= -37000000000.0) tmp = t_2; elseif (x <= -5.5e-257) tmp = t_1; elseif (x <= 2.4e-275) tmp = Float64(Float64(y * Float64(1.0 - z)) - t); elseif (x <= 1e-31) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -log(y) - t; t_2 = (x * log(y)) - t; tmp = 0.0; if (x <= -37000000000.0) tmp = t_2; elseif (x <= -5.5e-257) tmp = t_1; elseif (x <= 2.4e-275) tmp = (y * (1.0 - z)) - t; elseif (x <= 1e-31) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[x, -37000000000.0], t$95$2, If[LessEqual[x, -5.5e-257], t$95$1, If[LessEqual[x, 2.4e-275], N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[x, 1e-31], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-\log y\right) - t\\
t_2 := x \cdot \log y - t\\
\mathbf{if}\;x \leq -37000000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq -5.5 \cdot 10^{-257}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-275}:\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\
\mathbf{elif}\;x \leq 10^{-31}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if x < -3.7e10 or 1e-31 < x Initial program 93.6%
Taylor expanded in z around inf 93.6%
*-commutative93.6%
sub-neg93.6%
mul-1-neg93.6%
log1p-def99.7%
mul-1-neg99.7%
Simplified99.7%
Taylor expanded in x around inf 92.8%
*-commutative92.8%
Simplified92.8%
if -3.7e10 < x < -5.50000000000000025e-257 or 2.39999999999999991e-275 < x < 1e-31Initial program 86.6%
+-commutative86.6%
fma-def86.6%
sub-neg86.6%
metadata-eval86.6%
sub-neg86.6%
log1p-def100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 84.5%
fma-neg84.5%
sub-neg84.5%
metadata-eval84.5%
+-commutative84.5%
Simplified84.5%
Taylor expanded in x around 0 83.8%
mul-1-neg83.8%
Simplified83.8%
if -5.50000000000000025e-257 < x < 2.39999999999999991e-275Initial program 48.5%
*-commutative48.5%
sub-neg48.5%
metadata-eval48.5%
distribute-lft-in48.5%
Applied egg-rr48.5%
distribute-lft-out48.5%
metadata-eval48.5%
sub-neg48.5%
add-sqr-sqrt0.0%
associate-*r*0.0%
sub-neg0.0%
metadata-eval0.0%
sub-neg0.0%
metadata-eval0.0%
Applied egg-rr0.0%
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%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 78.0%
Final simplification88.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -37000000000.0) (not (<= x 4.6e-35))) (- (- (* x (log y)) (* z y)) t) (- (- (- (* z y)) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -37000000000.0) || !(x <= 4.6e-35)) {
tmp = ((x * log(y)) - (z * y)) - t;
} else {
tmp = (-(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 <= (-37000000000.0d0)) .or. (.not. (x <= 4.6d-35))) then
tmp = ((x * log(y)) - (z * y)) - t
else
tmp = (-(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 <= -37000000000.0) || !(x <= 4.6e-35)) {
tmp = ((x * Math.log(y)) - (z * y)) - t;
} else {
tmp = (-(z * y) - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -37000000000.0) or not (x <= 4.6e-35): tmp = ((x * math.log(y)) - (z * y)) - t else: tmp = (-(z * y) - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -37000000000.0) || !(x <= 4.6e-35)) tmp = Float64(Float64(Float64(x * log(y)) - Float64(z * y)) - t); else tmp = Float64(Float64(Float64(-Float64(z * y)) - log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -37000000000.0) || ~((x <= 4.6e-35))) tmp = ((x * log(y)) - (z * y)) - t; else tmp = (-(z * y) - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -37000000000.0], N[Not[LessEqual[x, 4.6e-35]], $MachinePrecision]], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[((-N[(z * y), $MachinePrecision]) - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -37000000000 \lor \neg \left(x \leq 4.6 \cdot 10^{-35}\right):\\
\;\;\;\;\left(x \cdot \log y - z \cdot y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-z \cdot y\right) - \log y\right) - t\\
\end{array}
\end{array}
if x < -3.7e10 or 4.5999999999999998e-35 < x Initial program 93.0%
Taylor expanded in z around inf 93.0%
*-commutative93.0%
sub-neg93.0%
mul-1-neg93.0%
log1p-def99.7%
mul-1-neg99.7%
Simplified99.7%
Taylor expanded in y around 0 99.3%
mul-1-neg99.3%
*-commutative99.3%
distribute-rgt-neg-in99.3%
Simplified99.3%
Taylor expanded in x around inf 99.1%
*-commutative99.1%
Simplified99.1%
distribute-rgt-neg-out99.1%
unsub-neg99.1%
Applied egg-rr99.1%
if -3.7e10 < x < 4.5999999999999998e-35Initial program 82.7%
Taylor expanded in z around inf 82.1%
*-commutative82.1%
sub-neg82.1%
mul-1-neg82.1%
log1p-def99.3%
mul-1-neg99.3%
Simplified99.3%
Taylor expanded in y around 0 98.5%
mul-1-neg98.5%
*-commutative98.5%
distribute-rgt-neg-in98.5%
Simplified98.5%
Taylor expanded in x around 0 97.9%
mul-1-neg97.9%
unsub-neg97.9%
mul-1-neg97.9%
Simplified97.9%
Final simplification98.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -9.5e-15) (not (<= x 1.8e-22))) (- (* (+ -1.0 x) (log y)) t) (- (- (- (* z y)) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9.5e-15) || !(x <= 1.8e-22)) {
tmp = ((-1.0 + x) * log(y)) - t;
} else {
tmp = (-(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 <= (-9.5d-15)) .or. (.not. (x <= 1.8d-22))) then
tmp = (((-1.0d0) + x) * log(y)) - t
else
tmp = (-(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 <= -9.5e-15) || !(x <= 1.8e-22)) {
tmp = ((-1.0 + x) * Math.log(y)) - t;
} else {
tmp = (-(z * y) - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -9.5e-15) or not (x <= 1.8e-22): tmp = ((-1.0 + x) * math.log(y)) - t else: tmp = (-(z * y) - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -9.5e-15) || !(x <= 1.8e-22)) tmp = Float64(Float64(Float64(-1.0 + x) * log(y)) - t); else tmp = Float64(Float64(Float64(-Float64(z * y)) - log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -9.5e-15) || ~((x <= 1.8e-22))) tmp = ((-1.0 + x) * log(y)) - t; else tmp = (-(z * y) - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -9.5e-15], N[Not[LessEqual[x, 1.8e-22]], $MachinePrecision]], N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[((-N[(z * y), $MachinePrecision]) - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-15} \lor \neg \left(x \leq 1.8 \cdot 10^{-22}\right):\\
\;\;\;\;\left(-1 + x\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-z \cdot y\right) - \log y\right) - t\\
\end{array}
\end{array}
if x < -9.5000000000000005e-15 or 1.7999999999999999e-22 < x Initial program 95.3%
+-commutative95.3%
fma-def95.3%
sub-neg95.3%
metadata-eval95.3%
sub-neg95.3%
log1p-def99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 94.7%
if -9.5000000000000005e-15 < x < 1.7999999999999999e-22Initial program 80.2%
Taylor expanded in z around inf 79.5%
*-commutative79.5%
sub-neg79.5%
mul-1-neg79.5%
log1p-def99.3%
mul-1-neg99.3%
Simplified99.3%
Taylor expanded in y around 0 98.5%
mul-1-neg98.5%
*-commutative98.5%
distribute-rgt-neg-in98.5%
Simplified98.5%
Taylor expanded in x around 0 98.5%
mul-1-neg98.5%
unsub-neg98.5%
mul-1-neg98.5%
Simplified98.5%
Final simplification96.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -38000000000.0) (not (<= t 0.00092))) (- (* x (log y)) t) (+ t (* (+ -1.0 x) (log y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -38000000000.0) || !(t <= 0.00092)) {
tmp = (x * log(y)) - t;
} else {
tmp = t + ((-1.0 + x) * 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 ((t <= (-38000000000.0d0)) .or. (.not. (t <= 0.00092d0))) then
tmp = (x * log(y)) - t
else
tmp = t + (((-1.0d0) + x) * log(y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -38000000000.0) || !(t <= 0.00092)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = t + ((-1.0 + x) * Math.log(y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -38000000000.0) or not (t <= 0.00092): tmp = (x * math.log(y)) - t else: tmp = t + ((-1.0 + x) * math.log(y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -38000000000.0) || !(t <= 0.00092)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(t + Float64(Float64(-1.0 + x) * log(y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -38000000000.0) || ~((t <= 0.00092))) tmp = (x * log(y)) - t; else tmp = t + ((-1.0 + x) * log(y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -38000000000.0], N[Not[LessEqual[t, 0.00092]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(t + N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -38000000000 \lor \neg \left(t \leq 0.00092\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;t + \left(-1 + x\right) \cdot \log y\\
\end{array}
\end{array}
if t < -3.8e10 or 9.2000000000000003e-4 < t Initial program 94.2%
Taylor expanded in z around inf 94.2%
*-commutative94.2%
sub-neg94.2%
mul-1-neg94.2%
log1p-def99.9%
mul-1-neg99.9%
Simplified99.9%
Taylor expanded in x around inf 92.0%
*-commutative92.0%
Simplified92.0%
if -3.8e10 < t < 9.2000000000000003e-4Initial program 82.6%
+-commutative82.6%
fma-def82.6%
sub-neg82.6%
metadata-eval82.6%
sub-neg82.6%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 81.1%
fma-neg81.1%
sub-neg81.1%
metadata-eval81.1%
+-commutative81.1%
Simplified81.1%
fma-udef81.1%
+-commutative81.1%
metadata-eval81.1%
sub-neg81.1%
*-commutative81.1%
sub-neg81.1%
metadata-eval81.1%
add-sqr-sqrt43.7%
sqrt-unprod80.9%
sqr-neg80.9%
sqrt-unprod37.2%
add-sqr-sqrt80.1%
Applied egg-rr80.1%
Final simplification85.5%
(FPCore (x y z t) :precision binary64 (if (<= z -2.55e+143) (- (- (* z y)) t) (if (<= z 6.2e+85) (- (- (log y)) t) (- (* y (- 1.0 z)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.55e+143) {
tmp = -(z * y) - t;
} else if (z <= 6.2e+85) {
tmp = -log(y) - t;
} else {
tmp = (y * (1.0 - z)) - 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 <= (-2.55d+143)) then
tmp = -(z * y) - t
else if (z <= 6.2d+85) then
tmp = -log(y) - t
else
tmp = (y * (1.0d0 - z)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.55e+143) {
tmp = -(z * y) - t;
} else if (z <= 6.2e+85) {
tmp = -Math.log(y) - t;
} else {
tmp = (y * (1.0 - z)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.55e+143: tmp = -(z * y) - t elif z <= 6.2e+85: tmp = -math.log(y) - t else: tmp = (y * (1.0 - z)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.55e+143) tmp = Float64(Float64(-Float64(z * y)) - t); elseif (z <= 6.2e+85) tmp = Float64(Float64(-log(y)) - t); else tmp = Float64(Float64(y * Float64(1.0 - z)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.55e+143) tmp = -(z * y) - t; elseif (z <= 6.2e+85) tmp = -log(y) - t; else tmp = (y * (1.0 - z)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.55e+143], N[((-N[(z * y), $MachinePrecision]) - t), $MachinePrecision], If[LessEqual[z, 6.2e+85], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision], N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.55 \cdot 10^{+143}:\\
\;\;\;\;\left(-z \cdot y\right) - t\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+85}:\\
\;\;\;\;\left(-\log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\
\end{array}
\end{array}
if z < -2.55000000000000019e143Initial program 58.9%
Taylor expanded in z around inf 58.9%
*-commutative58.9%
sub-neg58.9%
mul-1-neg58.9%
log1p-def99.8%
mul-1-neg99.8%
Simplified99.8%
Taylor expanded in y around 0 97.8%
mul-1-neg97.8%
*-commutative97.8%
distribute-rgt-neg-in97.8%
Simplified97.8%
Taylor expanded in y around inf 60.0%
mul-1-neg60.0%
*-commutative60.0%
distribute-rgt-neg-in60.0%
Simplified60.0%
if -2.55000000000000019e143 < z < 6.20000000000000023e85Initial program 98.0%
+-commutative98.0%
fma-def98.0%
sub-neg98.0%
metadata-eval98.0%
sub-neg98.0%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 97.5%
fma-neg97.5%
sub-neg97.5%
metadata-eval97.5%
+-commutative97.5%
Simplified97.5%
Taylor expanded in x around 0 61.0%
mul-1-neg61.0%
Simplified61.0%
if 6.20000000000000023e85 < z Initial program 70.3%
*-commutative70.3%
sub-neg70.3%
metadata-eval70.3%
distribute-lft-in70.3%
Applied egg-rr70.3%
distribute-lft-out70.3%
metadata-eval70.3%
sub-neg70.3%
add-sqr-sqrt25.4%
associate-*r*25.4%
sub-neg25.4%
metadata-eval25.4%
sub-neg25.4%
metadata-eval25.4%
Applied egg-rr25.4%
Taylor expanded in y around 0 98.0%
+-commutative98.0%
sub-neg98.0%
metadata-eval98.0%
+-commutative98.0%
mul-1-neg98.0%
unsub-neg98.0%
+-commutative98.0%
sub-neg98.0%
metadata-eval98.0%
+-commutative98.0%
Simplified98.0%
Taylor expanded in y around inf 57.2%
Final simplification60.2%
(FPCore (x y z t) :precision binary64 (- (- (* (+ -1.0 x) (log y)) (* y (+ z -1.0))) t))
double code(double x, double y, double z, double t) {
return (((-1.0 + x) * log(y)) - (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 = ((((-1.0d0) + x) * log(y)) - (y * (z + (-1.0d0)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((-1.0 + x) * Math.log(y)) - (y * (z + -1.0))) - t;
}
def code(x, y, z, t): return (((-1.0 + x) * math.log(y)) - (y * (z + -1.0))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(-1.0 + x) * log(y)) - Float64(y * Float64(z + -1.0))) - t) end
function tmp = code(x, y, z, t) tmp = (((-1.0 + x) * log(y)) - (y * (z + -1.0))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(-1 + x\right) \cdot \log y - y \cdot \left(z + -1\right)\right) - t
\end{array}
Initial program 87.9%
*-commutative87.9%
sub-neg87.9%
metadata-eval87.9%
distribute-lft-in87.9%
Applied egg-rr87.9%
distribute-lft-out87.9%
metadata-eval87.9%
sub-neg87.9%
add-sqr-sqrt20.7%
associate-*r*20.7%
sub-neg20.7%
metadata-eval20.7%
sub-neg20.7%
metadata-eval20.7%
Applied egg-rr20.7%
Taylor expanded in y around 0 98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
mul-1-neg98.9%
unsub-neg98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x y z t) :precision binary64 (if (<= z 2.95e+170) (- (* (+ -1.0 x) (log y)) t) (- (* z (log1p (- y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 2.95e+170) {
tmp = ((-1.0 + x) * 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 <= 2.95e+170) {
tmp = ((-1.0 + x) * Math.log(y)) - t;
} else {
tmp = (z * Math.log1p(-y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 2.95e+170: tmp = ((-1.0 + x) * math.log(y)) - t else: tmp = (z * math.log1p(-y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 2.95e+170) tmp = Float64(Float64(Float64(-1.0 + x) * log(y)) - t); else tmp = Float64(Float64(z * log1p(Float64(-y))) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, 2.95e+170], N[(N[(N[(-1.0 + x), $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 2.95 \cdot 10^{+170}:\\
\;\;\;\;\left(-1 + x\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\end{array}
\end{array}
if z < 2.9499999999999997e170Initial program 91.8%
+-commutative91.8%
fma-def91.8%
sub-neg91.8%
metadata-eval91.8%
sub-neg91.8%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 91.0%
if 2.9499999999999997e170 < z Initial program 56.1%
Taylor expanded in z around inf 56.1%
*-commutative56.1%
sub-neg56.1%
mul-1-neg56.1%
log1p-def99.9%
mul-1-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 28.6%
sub-neg28.6%
log1p-def70.1%
Simplified70.1%
Final simplification88.7%
(FPCore (x y z t) :precision binary64 (- (- (* (+ -1.0 x) (log y)) (* z y)) t))
double code(double x, double y, double z, double t) {
return (((-1.0 + x) * 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 = ((((-1.0d0) + x) * log(y)) - (z * y)) - t
end function
public static double code(double x, double y, double z, double t) {
return (((-1.0 + x) * Math.log(y)) - (z * y)) - t;
}
def code(x, y, z, t): return (((-1.0 + x) * math.log(y)) - (z * y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(-1.0 + x) * log(y)) - Float64(z * y)) - t) end
function tmp = code(x, y, z, t) tmp = (((-1.0 + x) * log(y)) - (z * y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(-1 + x\right) \cdot \log y - z \cdot y\right) - t
\end{array}
Initial program 87.9%
Taylor expanded in z around inf 87.6%
*-commutative87.6%
sub-neg87.6%
mul-1-neg87.6%
log1p-def99.5%
mul-1-neg99.5%
Simplified99.5%
Taylor expanded in y around 0 98.9%
mul-1-neg98.9%
*-commutative98.9%
distribute-rgt-neg-in98.9%
Simplified98.9%
Final simplification98.9%
(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 87.9%
*-commutative87.9%
sub-neg87.9%
metadata-eval87.9%
distribute-lft-in87.9%
Applied egg-rr87.9%
distribute-lft-out87.9%
metadata-eval87.9%
sub-neg87.9%
add-sqr-sqrt20.7%
associate-*r*20.7%
sub-neg20.7%
metadata-eval20.7%
sub-neg20.7%
metadata-eval20.7%
Applied egg-rr20.7%
Taylor expanded in y around 0 98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
mul-1-neg98.9%
unsub-neg98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in y around inf 43.5%
Final simplification43.5%
(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(-Float64(z * 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}
\\
\left(-z \cdot y\right) - t
\end{array}
Initial program 87.9%
Taylor expanded in z around inf 87.6%
*-commutative87.6%
sub-neg87.6%
mul-1-neg87.6%
log1p-def99.5%
mul-1-neg99.5%
Simplified99.5%
Taylor expanded in y around 0 98.9%
mul-1-neg98.9%
*-commutative98.9%
distribute-rgt-neg-in98.9%
Simplified98.9%
Taylor expanded in y around inf 43.3%
mul-1-neg43.3%
*-commutative43.3%
distribute-rgt-neg-in43.3%
Simplified43.3%
Final simplification43.3%
(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 87.9%
+-commutative87.9%
fma-def87.9%
sub-neg87.9%
metadata-eval87.9%
sub-neg87.9%
log1p-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 32.1%
neg-mul-132.1%
Simplified32.1%
Final simplification32.1%
herbie shell --seed 2024026
(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))