
(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)) (fma (+ -1.0 x) (log y) (- t))))
double code(double x, double y, double z, double t) {
return fma((z + -1.0), log1p(-y), fma((-1.0 + x), log(y), -t));
}
function code(x, y, z, t) return fma(Float64(z + -1.0), log1p(Float64(-y)), fma(Float64(-1.0 + x), log(y), Float64(-t))) end
code[x_, y_, z_, t_] := N[(N[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \mathsf{fma}\left(-1 + x, \log y, -t\right)\right)
\end{array}
Initial program 88.6%
sub-neg88.6%
+-commutative88.6%
associate-+l+88.6%
fma-define88.6%
sub-neg88.6%
metadata-eval88.6%
sub-neg88.6%
log1p-define99.9%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(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 88.6%
+-commutative88.6%
fma-define88.6%
sub-neg88.6%
metadata-eval88.6%
sub-neg88.6%
log1p-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ z -1.0) -5e+20) (not (<= (+ z -1.0) 2e+29))) (- (* z (- (* (log y) (/ (+ -1.0 x) z)) y)) t) (- (* (+ -1.0 x) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((z + -1.0) <= -5e+20) || !((z + -1.0) <= 2e+29)) {
tmp = (z * ((log(y) * ((-1.0 + x) / z)) - y)) - t;
} else {
tmp = ((-1.0 + x) * 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.0d0)) <= (-5d+20)) .or. (.not. ((z + (-1.0d0)) <= 2d+29))) then
tmp = (z * ((log(y) * (((-1.0d0) + x) / z)) - y)) - t
else
tmp = (((-1.0d0) + x) * 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.0) <= -5e+20) || !((z + -1.0) <= 2e+29)) {
tmp = (z * ((Math.log(y) * ((-1.0 + x) / z)) - y)) - t;
} else {
tmp = ((-1.0 + x) * Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z + -1.0) <= -5e+20) or not ((z + -1.0) <= 2e+29): tmp = (z * ((math.log(y) * ((-1.0 + x) / z)) - y)) - t else: tmp = ((-1.0 + x) * math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z + -1.0) <= -5e+20) || !(Float64(z + -1.0) <= 2e+29)) tmp = Float64(Float64(z * Float64(Float64(log(y) * Float64(Float64(-1.0 + x) / z)) - y)) - t); else tmp = Float64(Float64(Float64(-1.0 + x) * log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z + -1.0) <= -5e+20) || ~(((z + -1.0) <= 2e+29))) tmp = (z * ((log(y) * ((-1.0 + x) / z)) - y)) - t; else tmp = ((-1.0 + x) * log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z + -1.0), $MachinePrecision], -5e+20], N[Not[LessEqual[N[(z + -1.0), $MachinePrecision], 2e+29]], $MachinePrecision]], N[(N[(z * N[(N[(N[Log[y], $MachinePrecision] * N[(N[(-1.0 + x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z + -1 \leq -5 \cdot 10^{+20} \lor \neg \left(z + -1 \leq 2 \cdot 10^{+29}\right):\\
\;\;\;\;z \cdot \left(\log y \cdot \frac{-1 + x}{z} - y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-1 + x\right) \cdot \log y - t\\
\end{array}
\end{array}
if (-.f64 z #s(literal 1 binary64)) < -5e20 or 1.99999999999999983e29 < (-.f64 z #s(literal 1 binary64)) Initial program 75.2%
Taylor expanded in y around 0 99.2%
Taylor expanded in y around 0 99.1%
associate-*r*99.1%
mul-1-neg99.1%
sub-neg99.1%
metadata-eval99.1%
*-commutative99.1%
fma-define99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
*-commutative99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in z around inf 99.1%
+-commutative99.1%
mul-1-neg99.1%
unsub-neg99.1%
+-commutative99.1%
associate-/l*99.0%
fma-define99.0%
sub-neg99.0%
metadata-eval99.0%
Simplified99.0%
Taylor expanded in y around 0 99.1%
sub-neg99.1%
metadata-eval99.1%
associate-*r/99.0%
Simplified99.0%
if -5e20 < (-.f64 z #s(literal 1 binary64)) < 1.99999999999999983e29Initial program 99.9%
Taylor expanded in y around 0 99.6%
Final simplification99.3%
(FPCore (x y z t)
:precision binary64
(if (<= (+ -1.0 x) -1e+47)
(- (* x (log y)) t)
(if (<= (+ -1.0 x) -0.4)
(- (* y (- 1.0 z)) (+ (log y) t))
(- (* (+ -1.0 x) (log y)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((-1.0 + x) <= -1e+47) {
tmp = (x * log(y)) - t;
} else if ((-1.0 + x) <= -0.4) {
tmp = (y * (1.0 - z)) - (log(y) + t);
} else {
tmp = ((-1.0 + x) * 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 (((-1.0d0) + x) <= (-1d+47)) then
tmp = (x * log(y)) - t
else if (((-1.0d0) + x) <= (-0.4d0)) then
tmp = (y * (1.0d0 - z)) - (log(y) + t)
else
tmp = (((-1.0d0) + x) * log(y)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((-1.0 + x) <= -1e+47) {
tmp = (x * Math.log(y)) - t;
} else if ((-1.0 + x) <= -0.4) {
tmp = (y * (1.0 - z)) - (Math.log(y) + t);
} else {
tmp = ((-1.0 + x) * Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (-1.0 + x) <= -1e+47: tmp = (x * math.log(y)) - t elif (-1.0 + x) <= -0.4: tmp = (y * (1.0 - z)) - (math.log(y) + t) else: tmp = ((-1.0 + x) * math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(-1.0 + x) <= -1e+47) tmp = Float64(Float64(x * log(y)) - t); elseif (Float64(-1.0 + x) <= -0.4) tmp = Float64(Float64(y * Float64(1.0 - z)) - Float64(log(y) + t)); else tmp = Float64(Float64(Float64(-1.0 + x) * log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((-1.0 + x) <= -1e+47) tmp = (x * log(y)) - t; elseif ((-1.0 + x) <= -0.4) tmp = (y * (1.0 - z)) - (log(y) + t); else tmp = ((-1.0 + x) * log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(-1.0 + x), $MachinePrecision], -1e+47], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(-1.0 + x), $MachinePrecision], -0.4], N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - N[(N[Log[y], $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -1 \cdot 10^{+47}:\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{elif}\;-1 + x \leq -0.4:\\
\;\;\;\;y \cdot \left(1 - z\right) - \left(\log y + t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-1 + x\right) \cdot \log y - t\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -1e47Initial program 94.9%
Taylor expanded in y around 0 99.6%
Taylor expanded in x around inf 94.9%
*-commutative94.9%
Simplified94.9%
if -1e47 < (-.f64 x #s(literal 1 binary64)) < -0.40000000000000002Initial program 84.1%
sub-neg84.1%
+-commutative84.1%
associate-+l+84.1%
fma-define84.1%
sub-neg84.1%
metadata-eval84.1%
sub-neg84.1%
log1p-define100.0%
fma-define100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 99.3%
mul-1-neg99.3%
Simplified99.3%
Taylor expanded in y around 0 98.6%
associate-*r*98.6%
mul-1-neg98.6%
sub-neg98.6%
metadata-eval98.6%
+-commutative98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in y around inf 76.5%
mul-1-neg76.5%
unsub-neg76.5%
mul-1-neg76.5%
sub-neg76.5%
metadata-eval76.5%
+-commutative76.5%
distribute-neg-in76.5%
metadata-eval76.5%
log-rec76.5%
mul-1-neg76.5%
remove-double-neg76.5%
+-commutative76.5%
Simplified76.5%
Taylor expanded in y around 0 98.6%
mul-1-neg98.6%
+-commutative98.6%
sub-neg98.6%
+-commutative98.6%
Simplified98.6%
if -0.40000000000000002 < (-.f64 x #s(literal 1 binary64)) Initial program 93.0%
Taylor expanded in y around 0 92.8%
Final simplification96.2%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ z -1.0) (* y (+ -1.0 (* y -0.5)))) (* (+ -1.0 x) (log y))) t))
double code(double x, double y, double z, double t) {
return (((z + -1.0) * (y * (-1.0 + (y * -0.5)))) + ((-1.0 + x) * log(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 + (-1.0d0)) * (y * ((-1.0d0) + (y * (-0.5d0))))) + (((-1.0d0) + x) * log(y))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((z + -1.0) * (y * (-1.0 + (y * -0.5)))) + ((-1.0 + x) * Math.log(y))) - t;
}
def code(x, y, z, t): return (((z + -1.0) * (y * (-1.0 + (y * -0.5)))) + ((-1.0 + x) * math.log(y))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(z + -1.0) * Float64(y * Float64(-1.0 + Float64(y * -0.5)))) + Float64(Float64(-1.0 + x) * log(y))) - t) end
function tmp = code(x, y, z, t) tmp = (((z + -1.0) * (y * (-1.0 + (y * -0.5)))) + ((-1.0 + x) * log(y))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(z + -1.0), $MachinePrecision] * N[(y * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(z + -1\right) \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right)\right) + \left(-1 + x\right) \cdot \log y\right) - t
\end{array}
Initial program 88.6%
Taylor expanded in y around 0 99.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -242000.0) (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 <= -242000.0) || !(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 <= (-242000.0d0)) .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 <= -242000.0) || !(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 <= -242000.0) 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 <= -242000.0) || !(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 <= -242000.0) || ~((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, -242000.0], 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 -242000 \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 < -242000 or 1 < x Initial program 93.0%
Taylor expanded in y around 0 99.7%
Taylor expanded in x around inf 92.9%
*-commutative92.9%
Simplified92.9%
if -242000 < x < 1Initial program 84.5%
Taylor expanded in y around 0 83.5%
Taylor expanded in x around 0 82.7%
mul-1-neg82.7%
Simplified82.7%
Final simplification87.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -242000.0) (not (<= x 1.0))) (- (* x (log y)) t) (- (- y t) (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -242000.0) || !(x <= 1.0)) {
tmp = (x * log(y)) - t;
} else {
tmp = (y - 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 <= (-242000.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = (x * log(y)) - t
else
tmp = (y - 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 <= -242000.0) || !(x <= 1.0)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = (y - t) - Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -242000.0) or not (x <= 1.0): tmp = (x * math.log(y)) - t else: tmp = (y - t) - math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -242000.0) || !(x <= 1.0)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(y - t) - log(y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -242000.0) || ~((x <= 1.0))) tmp = (x * log(y)) - t; else tmp = (y - t) - log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -242000.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y - t), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -242000 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(y - t\right) - \log y\\
\end{array}
\end{array}
if x < -242000 or 1 < x Initial program 93.0%
Taylor expanded in y around 0 99.7%
Taylor expanded in x around inf 92.9%
*-commutative92.9%
Simplified92.9%
if -242000 < x < 1Initial program 84.5%
sub-neg84.5%
+-commutative84.5%
associate-+l+84.5%
fma-define84.5%
sub-neg84.5%
metadata-eval84.5%
sub-neg84.5%
log1p-define100.0%
fma-define100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 99.2%
mul-1-neg99.2%
Simplified99.2%
Taylor expanded in y around 0 98.6%
associate-*r*98.6%
mul-1-neg98.6%
sub-neg98.6%
metadata-eval98.6%
+-commutative98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in z around 0 83.0%
associate--r+83.0%
Simplified83.0%
Final simplification87.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ -1.0 (* y -0.5))))
(if (<= z -1.05e+167)
(* z (- (* y t_1) (/ t z)))
(if (<= z 1.4e+93) (- (- t) (log y)) (- (* y (* z t_1)) t)))))
double code(double x, double y, double z, double t) {
double t_1 = -1.0 + (y * -0.5);
double tmp;
if (z <= -1.05e+167) {
tmp = z * ((y * t_1) - (t / z));
} else if (z <= 1.4e+93) {
tmp = -t - log(y);
} else {
tmp = (y * (z * t_1)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (-1.0d0) + (y * (-0.5d0))
if (z <= (-1.05d+167)) then
tmp = z * ((y * t_1) - (t / z))
else if (z <= 1.4d+93) then
tmp = -t - log(y)
else
tmp = (y * (z * t_1)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = -1.0 + (y * -0.5);
double tmp;
if (z <= -1.05e+167) {
tmp = z * ((y * t_1) - (t / z));
} else if (z <= 1.4e+93) {
tmp = -t - Math.log(y);
} else {
tmp = (y * (z * t_1)) - t;
}
return tmp;
}
def code(x, y, z, t): t_1 = -1.0 + (y * -0.5) tmp = 0 if z <= -1.05e+167: tmp = z * ((y * t_1) - (t / z)) elif z <= 1.4e+93: tmp = -t - math.log(y) else: tmp = (y * (z * t_1)) - t return tmp
function code(x, y, z, t) t_1 = Float64(-1.0 + Float64(y * -0.5)) tmp = 0.0 if (z <= -1.05e+167) tmp = Float64(z * Float64(Float64(y * t_1) - Float64(t / z))); elseif (z <= 1.4e+93) tmp = Float64(Float64(-t) - log(y)); else tmp = Float64(Float64(y * Float64(z * t_1)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -1.0 + (y * -0.5); tmp = 0.0; if (z <= -1.05e+167) tmp = z * ((y * t_1) - (t / z)); elseif (z <= 1.4e+93) tmp = -t - log(y); else tmp = (y * (z * t_1)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.05e+167], N[(z * N[(N[(y * t$95$1), $MachinePrecision] - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.4e+93], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(z * t$95$1), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -1 + y \cdot -0.5\\
\mathbf{if}\;z \leq -1.05 \cdot 10^{+167}:\\
\;\;\;\;z \cdot \left(y \cdot t\_1 - \frac{t}{z}\right)\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+93}:\\
\;\;\;\;\left(-t\right) - \log y\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z \cdot t\_1\right) - t\\
\end{array}
\end{array}
if z < -1.05e167Initial program 62.1%
Taylor expanded in y around 0 99.6%
Taylor expanded in z around inf 53.5%
Taylor expanded in z around inf 53.6%
if -1.05e167 < z < 1.39999999999999994e93Initial program 97.5%
Taylor expanded in y around 0 96.8%
Taylor expanded in x around 0 59.5%
mul-1-neg59.5%
Simplified59.5%
if 1.39999999999999994e93 < z Initial program 66.1%
Taylor expanded in y around 0 99.9%
Taylor expanded in z around inf 68.4%
Final simplification60.7%
(FPCore (x y z t) :precision binary64 (if (<= (+ z -1.0) 2e+229) (- (* (+ -1.0 x) (log y)) t) (- (- t) (* z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z + -1.0) <= 2e+229) {
tmp = ((-1.0 + x) * log(y)) - t;
} else {
tmp = -t - (z * y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z + (-1.0d0)) <= 2d+229) then
tmp = (((-1.0d0) + x) * log(y)) - t
else
tmp = -t - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z + -1.0) <= 2e+229) {
tmp = ((-1.0 + x) * Math.log(y)) - t;
} else {
tmp = -t - (z * y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z + -1.0) <= 2e+229: tmp = ((-1.0 + x) * math.log(y)) - t else: tmp = -t - (z * y) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z + -1.0) <= 2e+229) tmp = Float64(Float64(Float64(-1.0 + x) * log(y)) - t); else tmp = Float64(Float64(-t) - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z + -1.0) <= 2e+229) tmp = ((-1.0 + x) * log(y)) - t; else tmp = -t - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z + -1.0), $MachinePrecision], 2e+229], N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z + -1 \leq 2 \cdot 10^{+229}:\\
\;\;\;\;\left(-1 + x\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - z \cdot y\\
\end{array}
\end{array}
if (-.f64 z #s(literal 1 binary64)) < 2e229Initial program 91.1%
Taylor expanded in y around 0 90.4%
if 2e229 < (-.f64 z #s(literal 1 binary64)) Initial program 45.7%
Taylor expanded in y around 0 100.0%
Taylor expanded in z around inf 86.4%
Taylor expanded in y around 0 86.4%
associate-*r*86.4%
mul-1-neg86.4%
Simplified86.4%
Final simplification90.2%
(FPCore (x y z t) :precision binary64 (- (- (* (+ -1.0 x) (log y)) (* (+ z -1.0) y)) t))
double code(double x, double y, double z, double t) {
return (((-1.0 + x) * log(y)) - ((z + -1.0) * y)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((((-1.0d0) + x) * log(y)) - ((z + (-1.0d0)) * y)) - t
end function
public static double code(double x, double y, double z, double t) {
return (((-1.0 + x) * Math.log(y)) - ((z + -1.0) * y)) - t;
}
def code(x, y, z, t): return (((-1.0 + x) * math.log(y)) - ((z + -1.0) * y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(-1.0 + x) * log(y)) - Float64(Float64(z + -1.0) * y)) - t) end
function tmp = code(x, y, z, t) tmp = (((-1.0 + x) * log(y)) - ((z + -1.0) * y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(N[(z + -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(-1 + x\right) \cdot \log y - \left(z + -1\right) \cdot y\right) - t
\end{array}
Initial program 88.6%
Taylor expanded in y around 0 99.5%
+-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
fma-define99.5%
mul-1-neg99.5%
fma-neg99.5%
+-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
+-commutative99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.6e-13) (not (<= t 5400.0))) (- t) (* y (- 1.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.6e-13) || !(t <= 5400.0)) {
tmp = -t;
} else {
tmp = y * (1.0 - z);
}
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 <= (-1.6d-13)) .or. (.not. (t <= 5400.0d0))) then
tmp = -t
else
tmp = y * (1.0d0 - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.6e-13) || !(t <= 5400.0)) {
tmp = -t;
} else {
tmp = y * (1.0 - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.6e-13) or not (t <= 5400.0): tmp = -t else: tmp = y * (1.0 - z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.6e-13) || !(t <= 5400.0)) tmp = Float64(-t); else tmp = Float64(y * Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.6e-13) || ~((t <= 5400.0))) tmp = -t; else tmp = y * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.6e-13], N[Not[LessEqual[t, 5400.0]], $MachinePrecision]], (-t), N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{-13} \lor \neg \left(t \leq 5400\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if t < -1.6e-13 or 5400 < t Initial program 94.9%
Taylor expanded in t around inf 64.3%
mul-1-neg64.3%
Simplified64.3%
if -1.6e-13 < t < 5400Initial program 82.2%
sub-neg82.2%
+-commutative82.2%
associate-+l+82.2%
fma-define82.2%
sub-neg82.2%
metadata-eval82.2%
sub-neg82.2%
log1p-define99.9%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 59.6%
mul-1-neg59.6%
Simplified59.6%
Taylor expanded in y around 0 58.9%
associate-*r*58.9%
mul-1-neg58.9%
sub-neg58.9%
metadata-eval58.9%
+-commutative58.9%
+-commutative58.9%
Simplified58.9%
Taylor expanded in y around inf 58.9%
mul-1-neg58.9%
unsub-neg58.9%
mul-1-neg58.9%
sub-neg58.9%
metadata-eval58.9%
+-commutative58.9%
distribute-neg-in58.9%
metadata-eval58.9%
log-rec58.9%
mul-1-neg58.9%
remove-double-neg58.9%
+-commutative58.9%
Simplified58.9%
Taylor expanded in y around inf 20.0%
Final simplification42.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.6e-13) (not (<= t 62000.0))) (- t) (* z (- y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.6e-13) || !(t <= 62000.0)) {
tmp = -t;
} else {
tmp = z * -y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.6d-13)) .or. (.not. (t <= 62000.0d0))) then
tmp = -t
else
tmp = z * -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.6e-13) || !(t <= 62000.0)) {
tmp = -t;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.6e-13) or not (t <= 62000.0): tmp = -t else: tmp = z * -y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.6e-13) || !(t <= 62000.0)) tmp = Float64(-t); else tmp = Float64(z * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.6e-13) || ~((t <= 62000.0))) tmp = -t; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.6e-13], N[Not[LessEqual[t, 62000.0]], $MachinePrecision]], (-t), N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{-13} \lor \neg \left(t \leq 62000\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if t < -1.6e-13 or 62000 < t Initial program 94.9%
Taylor expanded in t around inf 64.3%
mul-1-neg64.3%
Simplified64.3%
if -1.6e-13 < t < 62000Initial program 82.2%
Taylor expanded in y around 0 99.2%
Taylor expanded in y around 0 99.2%
associate-*r*99.2%
mul-1-neg99.2%
sub-neg99.2%
metadata-eval99.2%
*-commutative99.2%
fma-define99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
*-commutative99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in z around inf 19.4%
associate-*r*19.4%
mul-1-neg19.4%
Simplified19.4%
Final simplification41.8%
(FPCore (x y z t) :precision binary64 (- (* z (- (/ y z) y)) t))
double code(double x, double y, double z, double t) {
return (z * ((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 = (z * ((y / z) - y)) - t
end function
public static double code(double x, double y, double z, double t) {
return (z * ((y / z) - y)) - t;
}
def code(x, y, z, t): return (z * ((y / z) - y)) - t
function code(x, y, z, t) return Float64(Float64(z * Float64(Float64(y / z) - y)) - t) end
function tmp = code(x, y, z, t) tmp = (z * ((y / z) - y)) - t; end
code[x_, y_, z_, t_] := N[(N[(z * N[(N[(y / z), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(\frac{y}{z} - y\right) - t
\end{array}
Initial program 88.6%
Taylor expanded in y around 0 99.5%
Taylor expanded in y around 0 99.5%
associate-*r*99.5%
mul-1-neg99.5%
sub-neg99.5%
metadata-eval99.5%
*-commutative99.5%
fma-define99.5%
sub-neg99.5%
metadata-eval99.5%
+-commutative99.5%
*-commutative99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in z around inf 87.4%
+-commutative87.4%
mul-1-neg87.4%
unsub-neg87.4%
+-commutative87.4%
associate-/l*87.3%
fma-define87.3%
sub-neg87.3%
metadata-eval87.3%
Simplified87.3%
Taylor expanded in y around inf 44.7%
Final simplification44.7%
(FPCore (x y z t) :precision binary64 (- (- t) (* z y)))
double code(double x, double y, double z, double t) {
return -t - (z * y);
}
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)
end function
public static double code(double x, double y, double z, double t) {
return -t - (z * y);
}
def code(x, y, z, t): return -t - (z * y)
function code(x, y, z, t) return Float64(Float64(-t) - Float64(z * y)) end
function tmp = code(x, y, z, t) tmp = -t - (z * y); end
code[x_, y_, z_, t_] := N[((-t) - N[(z * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-t\right) - z \cdot y
\end{array}
Initial program 88.6%
Taylor expanded in y around 0 99.5%
Taylor expanded in z around inf 44.5%
Taylor expanded in y around 0 44.5%
associate-*r*44.5%
mul-1-neg44.5%
Simplified44.5%
Final simplification44.5%
(FPCore (x y z t) :precision binary64 (- t))
double code(double x, double y, double z, double t) {
return -t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -t
end function
public static double code(double x, double y, double z, double t) {
return -t;
}
def code(x, y, z, t): return -t
function code(x, y, z, t) return Float64(-t) end
function tmp = code(x, y, z, t) tmp = -t; end
code[x_, y_, z_, t_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 88.6%
Taylor expanded in t around inf 33.6%
mul-1-neg33.6%
Simplified33.6%
Final simplification33.6%
herbie shell --seed 2024077
(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))