
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
(FPCore (x y z t) :precision binary64 (- (fma (+ x -1.0) (log y) (* (log1p (- y)) (+ z -1.0))) t))
double code(double x, double y, double z, double t) {
return fma((x + -1.0), log(y), (log1p(-y) * (z + -1.0))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(x + -1.0), log(y), Float64(log1p(Float64(-y)) * Float64(z + -1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[Log[1 + (-y)], $MachinePrecision] * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x + -1, \log y, \mathsf{log1p}\left(-y\right) \cdot \left(z + -1\right)\right) - t
\end{array}
Initial program 87.6%
cancel-sign-sub87.6%
distribute-lft-neg-in87.6%
fma-neg87.6%
remove-double-neg87.6%
sub-neg87.6%
log1p-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (- (* (+ x -1.0) (log y)) (* (+ z -1.0) (- y (* y (* y -0.5))))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) - ((z + -1.0) * (y - (y * (y * -0.5))))) - 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 * (y * (-0.5d0)))))) - 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 * (y * -0.5))))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) - ((z + -1.0) * (y - (y * (y * -0.5))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) - Float64(Float64(z + -1.0) * Float64(y - Float64(y * Float64(y * -0.5))))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) - ((z + -1.0) * (y - (y * (y * -0.5))))) - 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[(y - N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y - \left(z + -1\right) \cdot \left(y - y \cdot \left(y \cdot -0.5\right)\right)\right) - t
\end{array}
Initial program 87.6%
Taylor expanded in y around 0 99.7%
mul-1-neg99.7%
unsub-neg99.7%
unpow299.7%
associate-*r*99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ x -1.0) -200.0) (not (<= (+ x -1.0) -1.0))) (- (- (* x (log y)) (* y z)) t) (- (- (* y (- 1.0 z)) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x + -1.0) <= -200.0) || !((x + -1.0) <= -1.0)) {
tmp = ((x * log(y)) - (y * z)) - t;
} else {
tmp = ((y * (1.0 - z)) - log(y)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x + (-1.0d0)) <= (-200.0d0)) .or. (.not. ((x + (-1.0d0)) <= (-1.0d0)))) then
tmp = ((x * log(y)) - (y * z)) - t
else
tmp = ((y * (1.0d0 - z)) - log(y)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x + -1.0) <= -200.0) || !((x + -1.0) <= -1.0)) {
tmp = ((x * Math.log(y)) - (y * z)) - t;
} else {
tmp = ((y * (1.0 - z)) - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x + -1.0) <= -200.0) or not ((x + -1.0) <= -1.0): tmp = ((x * math.log(y)) - (y * z)) - t else: tmp = ((y * (1.0 - z)) - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x + -1.0) <= -200.0) || !(Float64(x + -1.0) <= -1.0)) tmp = Float64(Float64(Float64(x * log(y)) - Float64(y * z)) - t); else tmp = Float64(Float64(Float64(y * Float64(1.0 - z)) - log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x + -1.0) <= -200.0) || ~(((x + -1.0) <= -1.0))) tmp = ((x * log(y)) - (y * z)) - t; else tmp = ((y * (1.0 - z)) - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x + -1.0), $MachinePrecision], -200.0], N[Not[LessEqual[N[(x + -1.0), $MachinePrecision], -1.0]], $MachinePrecision]], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + -1 \leq -200 \lor \neg \left(x + -1 \leq -1\right):\\
\;\;\;\;\left(x \cdot \log y - y \cdot z\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot \left(1 - z\right) - \log y\right) - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -200 or -1 < (-.f64 x 1) Initial program 92.0%
Taylor expanded in y around 0 99.7%
+-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
mul-1-neg99.7%
unsub-neg99.7%
*-commutative99.7%
+-commutative99.7%
*-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 99.0%
Taylor expanded in z around inf 99.0%
if -200 < (-.f64 x 1) < -1Initial program 83.7%
Taylor expanded in y around 0 99.5%
+-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
mul-1-neg99.5%
unsub-neg99.5%
*-commutative99.5%
+-commutative99.5%
*-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in x around 0 98.1%
neg-mul-198.1%
Simplified98.1%
Final simplification98.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.65e+117) (not (<= z 3.35e+140))) (- (- (* x (log y)) (* y z)) t) (- (* (+ x -1.0) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.65e+117) || !(z <= 3.35e+140)) {
tmp = ((x * 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 ((z <= (-1.65d+117)) .or. (.not. (z <= 3.35d+140))) then
tmp = ((x * 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 ((z <= -1.65e+117) || !(z <= 3.35e+140)) {
tmp = ((x * 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 (z <= -1.65e+117) or not (z <= 3.35e+140): tmp = ((x * 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 ((z <= -1.65e+117) || !(z <= 3.35e+140)) tmp = Float64(Float64(Float64(x * 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 ((z <= -1.65e+117) || ~((z <= 3.35e+140))) tmp = ((x * log(y)) - (y * z)) - t; else tmp = ((x + -1.0) * log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.65e+117], N[Not[LessEqual[z, 3.35e+140]], $MachinePrecision]], N[(N[(N[(x * 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}\;z \leq -1.65 \cdot 10^{+117} \lor \neg \left(z \leq 3.35 \cdot 10^{+140}\right):\\
\;\;\;\;\left(x \cdot \log y - y \cdot z\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(x + -1\right) \cdot \log y - t\\
\end{array}
\end{array}
if z < -1.6499999999999999e117 or 3.35e140 < z Initial program 64.3%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
+-commutative99.8%
*-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 92.6%
Taylor expanded in z around inf 92.6%
if -1.6499999999999999e117 < z < 3.35e140Initial program 96.1%
Taylor expanded in y around 0 95.6%
Final simplification94.8%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ x -1.0) (log y)) (* y (- 1.0 z))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + (y * (1.0 - z))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x + (-1.0d0)) * log(y)) + (y * (1.0d0 - z))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) + (y * (1.0 - z))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + (y * (1.0 - z))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(y * Float64(1.0 - z))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + (y * (1.0 - z))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + y \cdot \left(1 - z\right)\right) - t
\end{array}
Initial program 87.6%
Taylor expanded in y around 0 99.6%
+-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
mul-1-neg99.6%
unsub-neg99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x (log y)) t)))
(if (<= x -1.0)
t_1
(if (<= x 7.5e-78)
(- (- (log y)) t)
(if (<= x 1.5e+39) (- (* y (- 1.0 z)) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x * log(y)) - t;
double tmp;
if (x <= -1.0) {
tmp = t_1;
} else if (x <= 7.5e-78) {
tmp = -log(y) - t;
} else if (x <= 1.5e+39) {
tmp = (y * (1.0 - z)) - t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x * log(y)) - t
if (x <= (-1.0d0)) then
tmp = t_1
else if (x <= 7.5d-78) then
tmp = -log(y) - t
else if (x <= 1.5d+39) then
tmp = (y * (1.0d0 - z)) - t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * Math.log(y)) - t;
double tmp;
if (x <= -1.0) {
tmp = t_1;
} else if (x <= 7.5e-78) {
tmp = -Math.log(y) - t;
} else if (x <= 1.5e+39) {
tmp = (y * (1.0 - z)) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * math.log(y)) - t tmp = 0 if x <= -1.0: tmp = t_1 elif x <= 7.5e-78: tmp = -math.log(y) - t elif x <= 1.5e+39: tmp = (y * (1.0 - z)) - t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * log(y)) - t) tmp = 0.0 if (x <= -1.0) tmp = t_1; elseif (x <= 7.5e-78) tmp = Float64(Float64(-log(y)) - t); elseif (x <= 1.5e+39) tmp = Float64(Float64(y * Float64(1.0 - z)) - t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * log(y)) - t; tmp = 0.0; if (x <= -1.0) tmp = t_1; elseif (x <= 7.5e-78) tmp = -log(y) - t; elseif (x <= 1.5e+39) tmp = (y * (1.0 - z)) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[x, -1.0], t$95$1, If[LessEqual[x, 7.5e-78], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision], If[LessEqual[x, 1.5e+39], N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y - t\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-78}:\\
\;\;\;\;\left(-\log y\right) - t\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+39}:\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -1 or 1.5e39 < x Initial program 94.6%
Taylor expanded in y around 0 99.6%
+-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
mul-1-neg99.6%
unsub-neg99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in x around inf 98.9%
Taylor expanded in y around 0 93.6%
if -1 < x < 7.50000000000000041e-78Initial program 84.5%
+-commutative84.5%
associate--l+84.5%
fma-def84.5%
sub-neg84.5%
log1p-def99.9%
Simplified99.9%
Taylor expanded in x around 0 98.5%
mul-1-neg98.5%
Simplified98.5%
Taylor expanded in z around 0 82.8%
+-commutative82.8%
sub-neg82.8%
mul-1-neg82.8%
distribute-neg-out82.8%
sub-neg82.8%
log1p-def82.8%
+-commutative82.8%
Simplified82.8%
Taylor expanded in y around 0 82.3%
if 7.50000000000000041e-78 < x < 1.5e39Initial program 68.2%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
+-commutative100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 90.6%
Taylor expanded in y around inf 90.8%
Final simplification88.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x (log y)) t)))
(if (<= x -1.0)
t_1
(if (<= x 6.5e-77)
(- (- y t) (log y))
(if (<= x 1.5e+39) (- (* y (- 1.0 z)) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x * log(y)) - t;
double tmp;
if (x <= -1.0) {
tmp = t_1;
} else if (x <= 6.5e-77) {
tmp = (y - t) - log(y);
} else if (x <= 1.5e+39) {
tmp = (y * (1.0 - z)) - t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x * log(y)) - t
if (x <= (-1.0d0)) then
tmp = t_1
else if (x <= 6.5d-77) then
tmp = (y - t) - log(y)
else if (x <= 1.5d+39) then
tmp = (y * (1.0d0 - z)) - t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * Math.log(y)) - t;
double tmp;
if (x <= -1.0) {
tmp = t_1;
} else if (x <= 6.5e-77) {
tmp = (y - t) - Math.log(y);
} else if (x <= 1.5e+39) {
tmp = (y * (1.0 - z)) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * math.log(y)) - t tmp = 0 if x <= -1.0: tmp = t_1 elif x <= 6.5e-77: tmp = (y - t) - math.log(y) elif x <= 1.5e+39: tmp = (y * (1.0 - z)) - t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * log(y)) - t) tmp = 0.0 if (x <= -1.0) tmp = t_1; elseif (x <= 6.5e-77) tmp = Float64(Float64(y - t) - log(y)); elseif (x <= 1.5e+39) tmp = Float64(Float64(y * Float64(1.0 - z)) - t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * log(y)) - t; tmp = 0.0; if (x <= -1.0) tmp = t_1; elseif (x <= 6.5e-77) tmp = (y - t) - log(y); elseif (x <= 1.5e+39) tmp = (y * (1.0 - z)) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[x, -1.0], t$95$1, If[LessEqual[x, 6.5e-77], N[(N[(y - t), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.5e+39], N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y - t\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{-77}:\\
\;\;\;\;\left(y - t\right) - \log y\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+39}:\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -1 or 1.5e39 < x Initial program 94.6%
Taylor expanded in y around 0 99.6%
+-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
mul-1-neg99.6%
unsub-neg99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in x around inf 98.9%
Taylor expanded in y around 0 93.6%
if -1 < x < 6.4999999999999999e-77Initial program 84.5%
+-commutative84.5%
associate--l+84.5%
fma-def84.5%
sub-neg84.5%
log1p-def99.9%
Simplified99.9%
Taylor expanded in x around 0 98.5%
mul-1-neg98.5%
Simplified98.5%
Taylor expanded in z around 0 82.8%
+-commutative82.8%
sub-neg82.8%
mul-1-neg82.8%
distribute-neg-out82.8%
sub-neg82.8%
log1p-def82.8%
+-commutative82.8%
Simplified82.8%
Taylor expanded in y around 0 82.4%
associate-+r+82.4%
+-commutative82.4%
mul-1-neg82.4%
unsub-neg82.4%
Simplified82.4%
if 6.4999999999999999e-77 < x < 1.5e39Initial program 68.2%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
+-commutative100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 90.6%
Taylor expanded in y around inf 90.8%
Final simplification88.0%
(FPCore (x y z t) :precision binary64 (if (<= z 1.95e+218) (- (* (+ x -1.0) (log y)) t) (- (* y (- z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.95e+218) {
tmp = ((x + -1.0) * log(y)) - t;
} else {
tmp = (y * -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 <= 1.95d+218) then
tmp = ((x + (-1.0d0)) * log(y)) - t
else
tmp = (y * -z) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.95e+218) {
tmp = ((x + -1.0) * Math.log(y)) - t;
} else {
tmp = (y * -z) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 1.95e+218: tmp = ((x + -1.0) * math.log(y)) - t else: tmp = (y * -z) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 1.95e+218) tmp = Float64(Float64(Float64(x + -1.0) * log(y)) - t); else tmp = Float64(Float64(y * Float64(-z)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 1.95e+218) tmp = ((x + -1.0) * log(y)) - t; else tmp = (y * -z) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.95e+218], N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y * (-z)), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.95 \cdot 10^{+218}:\\
\;\;\;\;\left(x + -1\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right) - t\\
\end{array}
\end{array}
if z < 1.9500000000000001e218Initial program 91.4%
Taylor expanded in y around 0 90.9%
if 1.9500000000000001e218 < z Initial program 43.4%
Taylor expanded in y around 0 99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
mul-1-neg99.9%
unsub-neg99.9%
*-commutative99.9%
+-commutative99.9%
*-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 99.9%
Taylor expanded in z around inf 85.3%
associate-*r*85.3%
neg-mul-185.3%
Simplified85.3%
Final simplification90.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.1e+120) (not (<= z 5.5e+141))) (- (* y (- z)) t) (- (- (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.1e+120) || !(z <= 5.5e+141)) {
tmp = (y * -z) - t;
} else {
tmp = -log(y) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-4.1d+120)) .or. (.not. (z <= 5.5d+141))) then
tmp = (y * -z) - t
else
tmp = -log(y) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.1e+120) || !(z <= 5.5e+141)) {
tmp = (y * -z) - t;
} else {
tmp = -Math.log(y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.1e+120) or not (z <= 5.5e+141): tmp = (y * -z) - t else: tmp = -math.log(y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.1e+120) || !(z <= 5.5e+141)) tmp = Float64(Float64(y * Float64(-z)) - t); else tmp = Float64(Float64(-log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.1e+120) || ~((z <= 5.5e+141))) tmp = (y * -z) - t; else tmp = -log(y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.1e+120], N[Not[LessEqual[z, 5.5e+141]], $MachinePrecision]], N[(N[(y * (-z)), $MachinePrecision] - t), $MachinePrecision], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{+120} \lor \neg \left(z \leq 5.5 \cdot 10^{+141}\right):\\
\;\;\;\;y \cdot \left(-z\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-\log y\right) - t\\
\end{array}
\end{array}
if z < -4.1e120 or 5.49999999999999967e141 < z Initial program 64.3%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
+-commutative99.8%
*-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 92.6%
Taylor expanded in z around inf 68.6%
associate-*r*68.6%
neg-mul-168.6%
Simplified68.6%
if -4.1e120 < z < 5.49999999999999967e141Initial program 96.1%
+-commutative96.1%
associate--l+96.1%
fma-def96.1%
sub-neg96.1%
log1p-def99.8%
Simplified99.8%
Taylor expanded in x around 0 63.5%
mul-1-neg63.5%
Simplified63.5%
Taylor expanded in z around 0 59.6%
+-commutative59.6%
sub-neg59.6%
mul-1-neg59.6%
distribute-neg-out59.6%
sub-neg59.6%
log1p-def59.6%
+-commutative59.6%
Simplified59.6%
Taylor expanded in y around 0 59.2%
Final simplification61.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -9.6e-69) (not (<= t 2.8e-18))) (- (* y (- z)) t) (- (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9.6e-69) || !(t <= 2.8e-18)) {
tmp = (y * -z) - t;
} else {
tmp = -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 <= (-9.6d-69)) .or. (.not. (t <= 2.8d-18))) then
tmp = (y * -z) - t
else
tmp = -log(y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9.6e-69) || !(t <= 2.8e-18)) {
tmp = (y * -z) - t;
} else {
tmp = -Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -9.6e-69) or not (t <= 2.8e-18): tmp = (y * -z) - t else: tmp = -math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -9.6e-69) || !(t <= 2.8e-18)) tmp = Float64(Float64(y * Float64(-z)) - t); else tmp = Float64(-log(y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -9.6e-69) || ~((t <= 2.8e-18))) tmp = (y * -z) - t; else tmp = -log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -9.6e-69], N[Not[LessEqual[t, 2.8e-18]], $MachinePrecision]], N[(N[(y * (-z)), $MachinePrecision] - t), $MachinePrecision], (-N[Log[y], $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.6 \cdot 10^{-69} \lor \neg \left(t \leq 2.8 \cdot 10^{-18}\right):\\
\;\;\;\;y \cdot \left(-z\right) - t\\
\mathbf{else}:\\
\;\;\;\;-\log y\\
\end{array}
\end{array}
if t < -9.6000000000000005e-69 or 2.80000000000000012e-18 < t Initial program 94.1%
Taylor expanded in y around 0 99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
mul-1-neg99.9%
unsub-neg99.9%
*-commutative99.9%
+-commutative99.9%
*-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 97.0%
Taylor expanded in z around inf 68.3%
associate-*r*68.3%
neg-mul-168.3%
Simplified68.3%
if -9.6000000000000005e-69 < t < 2.80000000000000012e-18Initial program 79.0%
+-commutative79.0%
associate--l+79.0%
fma-def79.0%
sub-neg79.0%
log1p-def99.7%
Simplified99.7%
Taylor expanded in x around 0 60.8%
mul-1-neg60.8%
Simplified60.8%
Taylor expanded in z around 0 39.4%
+-commutative39.4%
sub-neg39.4%
mul-1-neg39.4%
distribute-neg-out39.4%
sub-neg39.4%
log1p-def39.4%
+-commutative39.4%
Simplified39.4%
Taylor expanded in y around 0 38.8%
Taylor expanded in t around 0 38.8%
Final simplification55.7%
(FPCore (x y z t) :precision binary64 (- (* y (- 1.0 z)) t))
double code(double x, double y, double z, double t) {
return (y * (1.0 - z)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (y * (1.0d0 - z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * (1.0 - z)) - t;
}
def code(x, y, z, t): return (y * (1.0 - z)) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(1.0 - z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * (1.0 - z)) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(1 - z\right) - t
\end{array}
Initial program 87.6%
Taylor expanded in y around 0 99.6%
+-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
mul-1-neg99.6%
unsub-neg99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in x around inf 81.3%
Taylor expanded in y around inf 48.9%
Final simplification48.9%
(FPCore (x y z t) :precision binary64 (- (* y (- z)) t))
double code(double x, double y, double z, double t) {
return (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 * -z) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * -z) - t;
}
def code(x, y, z, t): return (y * -z) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(-z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * -z) - t; end
code[x_, y_, z_, t_] := N[(N[(y * (-z)), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(-z\right) - t
\end{array}
Initial program 87.6%
Taylor expanded in y around 0 99.6%
+-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
mul-1-neg99.6%
unsub-neg99.6%
*-commutative99.6%
+-commutative99.6%
*-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in x around inf 81.3%
Taylor expanded in z around inf 48.8%
associate-*r*48.8%
neg-mul-148.8%
Simplified48.8%
Final simplification48.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 87.6%
cancel-sign-sub87.6%
distribute-lft-neg-in87.6%
fma-neg87.6%
remove-double-neg87.6%
sub-neg87.6%
log1p-def99.8%
Simplified99.8%
Taylor expanded in t around inf 37.2%
neg-mul-137.2%
Simplified37.2%
Final simplification37.2%
herbie shell --seed 2023185
(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))