
(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.0%
+-commutative88.0%
associate--l+88.0%
fma-define88.0%
sub-neg88.0%
metadata-eval88.0%
sub-neg88.0%
log1p-define99.9%
fma-neg99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (+ z -1.0) y)))
(if (or (<= (+ -1.0 x) -20.0) (not (<= (+ -1.0 x) -0.9998)))
(- (- (* x (log y)) t_1) t)
(- (- t) (+ (log y) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (z + -1.0) * y;
double tmp;
if (((-1.0 + x) <= -20.0) || !((-1.0 + x) <= -0.9998)) {
tmp = ((x * log(y)) - t_1) - t;
} else {
tmp = -t - (log(y) + 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 = (z + (-1.0d0)) * y
if ((((-1.0d0) + x) <= (-20.0d0)) .or. (.not. (((-1.0d0) + x) <= (-0.9998d0)))) then
tmp = ((x * log(y)) - t_1) - t
else
tmp = -t - (log(y) + t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z + -1.0) * y;
double tmp;
if (((-1.0 + x) <= -20.0) || !((-1.0 + x) <= -0.9998)) {
tmp = ((x * Math.log(y)) - t_1) - t;
} else {
tmp = -t - (Math.log(y) + t_1);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z + -1.0) * y tmp = 0 if ((-1.0 + x) <= -20.0) or not ((-1.0 + x) <= -0.9998): tmp = ((x * math.log(y)) - t_1) - t else: tmp = -t - (math.log(y) + t_1) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z + -1.0) * y) tmp = 0.0 if ((Float64(-1.0 + x) <= -20.0) || !(Float64(-1.0 + x) <= -0.9998)) tmp = Float64(Float64(Float64(x * log(y)) - t_1) - t); else tmp = Float64(Float64(-t) - Float64(log(y) + t_1)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z + -1.0) * y; tmp = 0.0; if (((-1.0 + x) <= -20.0) || ~(((-1.0 + x) <= -0.9998))) tmp = ((x * log(y)) - t_1) - t; else tmp = -t - (log(y) + t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z + -1.0), $MachinePrecision] * y), $MachinePrecision]}, If[Or[LessEqual[N[(-1.0 + x), $MachinePrecision], -20.0], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], -0.9998]], $MachinePrecision]], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[(N[Log[y], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z + -1\right) \cdot y\\
\mathbf{if}\;-1 + x \leq -20 \lor \neg \left(-1 + x \leq -0.9998\right):\\
\;\;\;\;\left(x \cdot \log y - t\_1\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \left(\log y + t\_1\right)\\
\end{array}
\end{array}
if (-.f64 x 1) < -20 or -0.99980000000000002 < (-.f64 x 1) Initial program 94.5%
Taylor expanded in y around 0 99.8%
mul-1-neg99.8%
Simplified99.8%
Taylor expanded in x around inf 98.8%
*-commutative98.8%
Simplified98.8%
*-commutative98.8%
add-sqr-sqrt0.0%
sqrt-unprod93.5%
sqr-neg93.5%
sqrt-unprod93.4%
add-sqr-sqrt93.4%
cancel-sign-sub93.4%
add-sqr-sqrt0.0%
sqrt-unprod98.0%
sqr-neg98.0%
sqrt-unprod98.7%
add-sqr-sqrt98.8%
sub-neg98.8%
metadata-eval98.8%
Applied egg-rr98.8%
if -20 < (-.f64 x 1) < -0.99980000000000002Initial program 81.1%
Taylor expanded in y around 0 100.0%
mul-1-neg100.0%
Simplified100.0%
flip3--100.0%
associate-*l/100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
fma-define100.0%
metadata-eval100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 99.7%
+-commutative99.7%
mul-1-neg99.7%
unsub-neg99.7%
mul-1-neg99.7%
sub-neg99.7%
metadata-eval99.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
+-commutative99.7%
Simplified99.7%
Final simplification99.2%
(FPCore (x y z t)
:precision binary64
(if (<= (+ -1.0 x) -5000000.0)
(- (* x (log y)) t)
(if (<= (+ -1.0 x) -1.0)
(- (- t) (+ (log y) (* (+ z -1.0) y)))
(- (* (log y) (+ -1.0 x)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((-1.0 + x) <= -5000000.0) {
tmp = (x * log(y)) - t;
} else if ((-1.0 + x) <= -1.0) {
tmp = -t - (log(y) + ((z + -1.0) * y));
} else {
tmp = (log(y) * (-1.0 + x)) - 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) <= (-5000000.0d0)) then
tmp = (x * log(y)) - t
else if (((-1.0d0) + x) <= (-1.0d0)) then
tmp = -t - (log(y) + ((z + (-1.0d0)) * y))
else
tmp = (log(y) * ((-1.0d0) + x)) - 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) <= -5000000.0) {
tmp = (x * Math.log(y)) - t;
} else if ((-1.0 + x) <= -1.0) {
tmp = -t - (Math.log(y) + ((z + -1.0) * y));
} else {
tmp = (Math.log(y) * (-1.0 + x)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (-1.0 + x) <= -5000000.0: tmp = (x * math.log(y)) - t elif (-1.0 + x) <= -1.0: tmp = -t - (math.log(y) + ((z + -1.0) * y)) else: tmp = (math.log(y) * (-1.0 + x)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(-1.0 + x) <= -5000000.0) tmp = Float64(Float64(x * log(y)) - t); elseif (Float64(-1.0 + x) <= -1.0) tmp = Float64(Float64(-t) - Float64(log(y) + Float64(Float64(z + -1.0) * y))); else tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((-1.0 + x) <= -5000000.0) tmp = (x * log(y)) - t; elseif ((-1.0 + x) <= -1.0) tmp = -t - (log(y) + ((z + -1.0) * y)); else tmp = (log(y) * (-1.0 + x)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(-1.0 + x), $MachinePrecision], -5000000.0], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(-1.0 + x), $MachinePrecision], -1.0], N[((-t) - N[(N[Log[y], $MachinePrecision] + N[(N[(z + -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -5000000:\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{elif}\;-1 + x \leq -1:\\
\;\;\;\;\left(-t\right) - \left(\log y + \left(z + -1\right) \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -5e6Initial program 97.9%
Taylor expanded in y around 0 99.8%
mul-1-neg99.8%
Simplified99.8%
Taylor expanded in x around inf 97.9%
*-commutative97.9%
Simplified97.9%
if -5e6 < (-.f64 x 1) < -1Initial program 80.7%
Taylor expanded in y around 0 100.0%
mul-1-neg100.0%
Simplified100.0%
flip3--100.0%
associate-*l/100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
fma-define100.0%
metadata-eval100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 99.2%
+-commutative99.2%
mul-1-neg99.2%
unsub-neg99.2%
mul-1-neg99.2%
sub-neg99.2%
metadata-eval99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
+-commutative99.2%
Simplified99.2%
if -1 < (-.f64 x 1) Initial program 93.2%
+-commutative93.2%
fma-define93.2%
sub-neg93.2%
metadata-eval93.2%
sub-neg93.2%
log1p-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 93.2%
Final simplification97.2%
(FPCore (x y z t)
:precision binary64
(if (<= (+ -1.0 x) -5000000.0)
(- (* x (log y)) t)
(if (<= (+ -1.0 x) -1.0)
(- (- t) (+ (log y) (* (+ z -1.0) y)))
(- (- t) (* (+ -1.0 x) (log (/ 1.0 y)))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((-1.0 + x) <= -5000000.0) {
tmp = (x * log(y)) - t;
} else if ((-1.0 + x) <= -1.0) {
tmp = -t - (log(y) + ((z + -1.0) * y));
} else {
tmp = -t - ((-1.0 + x) * log((1.0 / 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 (((-1.0d0) + x) <= (-5000000.0d0)) then
tmp = (x * log(y)) - t
else if (((-1.0d0) + x) <= (-1.0d0)) then
tmp = -t - (log(y) + ((z + (-1.0d0)) * y))
else
tmp = -t - (((-1.0d0) + x) * log((1.0d0 / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((-1.0 + x) <= -5000000.0) {
tmp = (x * Math.log(y)) - t;
} else if ((-1.0 + x) <= -1.0) {
tmp = -t - (Math.log(y) + ((z + -1.0) * y));
} else {
tmp = -t - ((-1.0 + x) * Math.log((1.0 / y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (-1.0 + x) <= -5000000.0: tmp = (x * math.log(y)) - t elif (-1.0 + x) <= -1.0: tmp = -t - (math.log(y) + ((z + -1.0) * y)) else: tmp = -t - ((-1.0 + x) * math.log((1.0 / y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(-1.0 + x) <= -5000000.0) tmp = Float64(Float64(x * log(y)) - t); elseif (Float64(-1.0 + x) <= -1.0) tmp = Float64(Float64(-t) - Float64(log(y) + Float64(Float64(z + -1.0) * y))); else tmp = Float64(Float64(-t) - Float64(Float64(-1.0 + x) * log(Float64(1.0 / y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((-1.0 + x) <= -5000000.0) tmp = (x * log(y)) - t; elseif ((-1.0 + x) <= -1.0) tmp = -t - (log(y) + ((z + -1.0) * y)); else tmp = -t - ((-1.0 + x) * log((1.0 / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(-1.0 + x), $MachinePrecision], -5000000.0], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(-1.0 + x), $MachinePrecision], -1.0], N[((-t) - N[(N[Log[y], $MachinePrecision] + N[(N[(z + -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-t) - N[(N[(-1.0 + x), $MachinePrecision] * N[Log[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -5000000:\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{elif}\;-1 + x \leq -1:\\
\;\;\;\;\left(-t\right) - \left(\log y + \left(z + -1\right) \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \left(-1 + x\right) \cdot \log \left(\frac{1}{y}\right)\\
\end{array}
\end{array}
if (-.f64 x 1) < -5e6Initial program 97.9%
Taylor expanded in y around 0 99.8%
mul-1-neg99.8%
Simplified99.8%
Taylor expanded in x around inf 97.9%
*-commutative97.9%
Simplified97.9%
if -5e6 < (-.f64 x 1) < -1Initial program 80.7%
Taylor expanded in y around 0 100.0%
mul-1-neg100.0%
Simplified100.0%
flip3--100.0%
associate-*l/100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
fma-define100.0%
metadata-eval100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 99.2%
+-commutative99.2%
mul-1-neg99.2%
unsub-neg99.2%
mul-1-neg99.2%
sub-neg99.2%
metadata-eval99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
+-commutative99.2%
Simplified99.2%
if -1 < (-.f64 x 1) Initial program 93.2%
+-commutative93.2%
fma-define93.2%
sub-neg93.2%
metadata-eval93.2%
sub-neg93.2%
log1p-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 93.2%
fma-neg93.2%
sub-neg93.2%
metadata-eval93.2%
+-commutative93.2%
Simplified93.2%
Taylor expanded in y around inf 93.2%
Final simplification97.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.8e+215) (not (<= z 4.2e+216))) (- (- t) (* z y)) (- (+ y (* (log y) (+ -1.0 x))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.8e+215) || !(z <= 4.2e+216)) {
tmp = -t - (z * y);
} else {
tmp = (y + (log(y) * (-1.0 + x))) - 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 <= (-5.8d+215)) .or. (.not. (z <= 4.2d+216))) then
tmp = -t - (z * y)
else
tmp = (y + (log(y) * ((-1.0d0) + x))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.8e+215) || !(z <= 4.2e+216)) {
tmp = -t - (z * y);
} else {
tmp = (y + (Math.log(y) * (-1.0 + x))) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.8e+215) or not (z <= 4.2e+216): tmp = -t - (z * y) else: tmp = (y + (math.log(y) * (-1.0 + x))) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.8e+215) || !(z <= 4.2e+216)) tmp = Float64(Float64(-t) - Float64(z * y)); else tmp = Float64(Float64(y + Float64(log(y) * Float64(-1.0 + x))) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.8e+215) || ~((z <= 4.2e+216))) tmp = -t - (z * y); else tmp = (y + (log(y) * (-1.0 + x))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.8e+215], N[Not[LessEqual[z, 4.2e+216]], $MachinePrecision]], N[((-t) - N[(z * y), $MachinePrecision]), $MachinePrecision], N[(N[(y + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+215} \lor \neg \left(z \leq 4.2 \cdot 10^{+216}\right):\\
\;\;\;\;\left(-t\right) - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(y + \log y \cdot \left(-1 + x\right)\right) - t\\
\end{array}
\end{array}
if z < -5.7999999999999999e215 or 4.20000000000000003e216 < z Initial program 57.2%
Taylor expanded in y around 0 99.9%
mul-1-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 77.8%
mul-1-neg77.8%
*-commutative77.8%
distribute-rgt-neg-in77.8%
Simplified77.8%
if -5.7999999999999999e215 < z < 4.20000000000000003e216Initial program 95.6%
Taylor expanded in y around 0 99.9%
mul-1-neg99.9%
Simplified99.9%
Taylor expanded in z around 0 95.6%
Final simplification92.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.2e+217) (not (<= z 4.1e+216))) (- (- t) (* z y)) (- (* (log y) (+ -1.0 x)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.2e+217) || !(z <= 4.1e+216)) {
tmp = -t - (z * y);
} else {
tmp = (log(y) * (-1.0 + x)) - 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.2d+217)) .or. (.not. (z <= 4.1d+216))) then
tmp = -t - (z * y)
else
tmp = (log(y) * ((-1.0d0) + x)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.2e+217) || !(z <= 4.1e+216)) {
tmp = -t - (z * y);
} else {
tmp = (Math.log(y) * (-1.0 + x)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.2e+217) or not (z <= 4.1e+216): tmp = -t - (z * y) else: tmp = (math.log(y) * (-1.0 + x)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.2e+217) || !(z <= 4.1e+216)) tmp = Float64(Float64(-t) - Float64(z * y)); else tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.2e+217) || ~((z <= 4.1e+216))) tmp = -t - (z * y); else tmp = (log(y) * (-1.0 + x)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.2e+217], N[Not[LessEqual[z, 4.1e+216]], $MachinePrecision]], N[((-t) - N[(z * y), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+217} \lor \neg \left(z \leq 4.1 \cdot 10^{+216}\right):\\
\;\;\;\;\left(-t\right) - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\end{array}
\end{array}
if z < -4.2000000000000002e217 or 4.0999999999999998e216 < z Initial program 57.2%
Taylor expanded in y around 0 99.9%
mul-1-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 77.8%
mul-1-neg77.8%
*-commutative77.8%
distribute-rgt-neg-in77.8%
Simplified77.8%
if -4.2000000000000002e217 < z < 4.0999999999999998e216Initial program 95.6%
+-commutative95.6%
fma-define95.6%
sub-neg95.6%
metadata-eval95.6%
sub-neg95.6%
log1p-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 95.5%
Final simplification92.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.65e+14) (not (<= t 8.6e+74))) (- (- t) (* z y)) (* (log y) (+ -1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.65e+14) || !(t <= 8.6e+74)) {
tmp = -t - (z * y);
} else {
tmp = log(y) * (-1.0 + x);
}
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 <= (-2.65d+14)) .or. (.not. (t <= 8.6d+74))) then
tmp = -t - (z * y)
else
tmp = log(y) * ((-1.0d0) + x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.65e+14) || !(t <= 8.6e+74)) {
tmp = -t - (z * y);
} else {
tmp = Math.log(y) * (-1.0 + x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.65e+14) or not (t <= 8.6e+74): tmp = -t - (z * y) else: tmp = math.log(y) * (-1.0 + x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.65e+14) || !(t <= 8.6e+74)) tmp = Float64(Float64(-t) - Float64(z * y)); else tmp = Float64(log(y) * Float64(-1.0 + x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.65e+14) || ~((t <= 8.6e+74))) tmp = -t - (z * y); else tmp = log(y) * (-1.0 + x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.65e+14], N[Not[LessEqual[t, 8.6e+74]], $MachinePrecision]], N[((-t) - N[(z * y), $MachinePrecision]), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.65 \cdot 10^{+14} \lor \neg \left(t \leq 8.6 \cdot 10^{+74}\right):\\
\;\;\;\;\left(-t\right) - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right)\\
\end{array}
\end{array}
if t < -2.65e14 or 8.60000000000000001e74 < t Initial program 94.2%
Taylor expanded in y around 0 99.9%
mul-1-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 80.3%
mul-1-neg80.3%
*-commutative80.3%
distribute-rgt-neg-in80.3%
Simplified80.3%
if -2.65e14 < t < 8.60000000000000001e74Initial program 83.4%
+-commutative83.4%
fma-define83.4%
sub-neg83.4%
metadata-eval83.4%
sub-neg83.4%
log1p-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 83.2%
Taylor expanded in t around 0 78.3%
Final simplification79.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -95000000.0) (not (<= t 2400.0))) (- (* x (log y)) t) (* (log y) (+ -1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -95000000.0) || !(t <= 2400.0)) {
tmp = (x * log(y)) - t;
} else {
tmp = log(y) * (-1.0 + x);
}
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 <= (-95000000.0d0)) .or. (.not. (t <= 2400.0d0))) then
tmp = (x * log(y)) - t
else
tmp = log(y) * ((-1.0d0) + x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -95000000.0) || !(t <= 2400.0)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = Math.log(y) * (-1.0 + x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -95000000.0) or not (t <= 2400.0): tmp = (x * math.log(y)) - t else: tmp = math.log(y) * (-1.0 + x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -95000000.0) || !(t <= 2400.0)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(log(y) * Float64(-1.0 + x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -95000000.0) || ~((t <= 2400.0))) tmp = (x * log(y)) - t; else tmp = log(y) * (-1.0 + x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -95000000.0], N[Not[LessEqual[t, 2400.0]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -95000000 \lor \neg \left(t \leq 2400\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right)\\
\end{array}
\end{array}
if t < -9.5e7 or 2400 < t Initial program 94.3%
Taylor expanded in y around 0 99.9%
mul-1-neg99.9%
Simplified99.9%
Taylor expanded in x around inf 93.6%
*-commutative93.6%
Simplified93.6%
if -9.5e7 < t < 2400Initial program 81.6%
+-commutative81.6%
fma-define81.6%
sub-neg81.6%
metadata-eval81.6%
sub-neg81.6%
log1p-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 81.4%
Taylor expanded in t around 0 81.3%
Final simplification87.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.9e+132) (not (<= z 4.6e+146))) (- (- t) (* z y)) (- (- t) (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.9e+132) || !(z <= 4.6e+146)) {
tmp = -t - (z * y);
} else {
tmp = -t - log(y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-3.9d+132)) .or. (.not. (z <= 4.6d+146))) then
tmp = -t - (z * y)
else
tmp = -t - log(y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.9e+132) || !(z <= 4.6e+146)) {
tmp = -t - (z * y);
} else {
tmp = -t - Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.9e+132) or not (z <= 4.6e+146): tmp = -t - (z * y) else: tmp = -t - math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.9e+132) || !(z <= 4.6e+146)) tmp = Float64(Float64(-t) - Float64(z * y)); else tmp = Float64(Float64(-t) - log(y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.9e+132) || ~((z <= 4.6e+146))) tmp = -t - (z * y); else tmp = -t - log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.9e+132], N[Not[LessEqual[z, 4.6e+146]], $MachinePrecision]], N[((-t) - N[(z * y), $MachinePrecision]), $MachinePrecision], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9 \cdot 10^{+132} \lor \neg \left(z \leq 4.6 \cdot 10^{+146}\right):\\
\;\;\;\;\left(-t\right) - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \log y\\
\end{array}
\end{array}
if z < -3.90000000000000001e132 or 4.60000000000000001e146 < z Initial program 68.1%
Taylor expanded in y around 0 99.8%
mul-1-neg99.8%
Simplified99.8%
Taylor expanded in z around inf 65.2%
mul-1-neg65.2%
*-commutative65.2%
distribute-rgt-neg-in65.2%
Simplified65.2%
if -3.90000000000000001e132 < z < 4.60000000000000001e146Initial program 98.7%
+-commutative98.7%
fma-define98.7%
sub-neg98.7%
metadata-eval98.7%
sub-neg98.7%
log1p-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 98.6%
fma-neg98.6%
sub-neg98.6%
metadata-eval98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in x around 0 60.8%
mul-1-neg60.8%
Simplified60.8%
Final simplification62.4%
(FPCore (x y z t) :precision binary64 (- (- (* (log y) (+ -1.0 x)) (* (+ z -1.0) y)) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) - ((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 = ((log(y) * ((-1.0d0) + x)) - ((z + (-1.0d0)) * y)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (-1.0 + x)) - ((z + -1.0) * y)) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) - ((z + -1.0) * y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) - Float64(Float64(z + -1.0) * y)) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (-1.0 + x)) - ((z + -1.0) * y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - N[(N[(z + -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(-1 + x\right) - \left(z + -1\right) \cdot y\right) - t
\end{array}
Initial program 88.0%
Taylor expanded in y around 0 99.9%
mul-1-neg99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -9e-33) (not (<= t 72000000.0))) (- t) (* z (- y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9e-33) || !(t <= 72000000.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 <= (-9d-33)) .or. (.not. (t <= 72000000.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 <= -9e-33) || !(t <= 72000000.0)) {
tmp = -t;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -9e-33) or not (t <= 72000000.0): tmp = -t else: tmp = z * -y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -9e-33) || !(t <= 72000000.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 <= -9e-33) || ~((t <= 72000000.0))) tmp = -t; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -9e-33], N[Not[LessEqual[t, 72000000.0]], $MachinePrecision]], (-t), N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{-33} \lor \neg \left(t \leq 72000000\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if t < -8.99999999999999982e-33 or 7.2e7 < t Initial program 94.5%
+-commutative94.5%
fma-define94.5%
sub-neg94.5%
metadata-eval94.5%
sub-neg94.5%
log1p-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 65.7%
mul-1-neg65.7%
Simplified65.7%
if -8.99999999999999982e-33 < t < 7.2e7Initial program 80.8%
Taylor expanded in y around 0 99.9%
mul-1-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 22.0%
mul-1-neg22.0%
*-commutative22.0%
distribute-rgt-neg-in22.0%
Simplified22.0%
Taylor expanded in z around inf 21.9%
mul-1-neg21.9%
*-commutative21.9%
distribute-rgt-neg-in21.9%
Simplified21.9%
Final simplification44.8%
(FPCore (x y z t) :precision binary64 (- (* y (- 1.0 z)) t))
double code(double x, double y, double z, double t) {
return (y * (1.0 - z)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (y * (1.0d0 - z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * (1.0 - z)) - t;
}
def code(x, y, z, t): return (y * (1.0 - z)) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(1.0 - z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * (1.0 - z)) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(1 - z\right) - t
\end{array}
Initial program 88.0%
Taylor expanded in y around 0 99.9%
mul-1-neg99.9%
Simplified99.9%
Taylor expanded in y around inf 47.8%
mul-1-neg47.8%
distribute-rgt-neg-in47.8%
sub-neg47.8%
metadata-eval47.8%
+-commutative47.8%
distribute-neg-in47.8%
metadata-eval47.8%
unsub-neg47.8%
Simplified47.8%
Final simplification47.8%
(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.0%
Taylor expanded in y around 0 99.9%
mul-1-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 47.6%
mul-1-neg47.6%
*-commutative47.6%
distribute-rgt-neg-in47.6%
Simplified47.6%
Final simplification47.6%
(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.0%
+-commutative88.0%
fma-define88.0%
sub-neg88.0%
metadata-eval88.0%
sub-neg88.0%
log1p-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 35.7%
mul-1-neg35.7%
Simplified35.7%
Final simplification35.7%
(FPCore (x y z t) :precision binary64 y)
double code(double x, double y, double z, double t) {
return 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 = y
end function
public static double code(double x, double y, double z, double t) {
return y;
}
def code(x, y, z, t): return y
function code(x, y, z, t) return y end
function tmp = code(x, y, z, t) tmp = y; end
code[x_, y_, z_, t_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 88.0%
Taylor expanded in y around 0 99.9%
mul-1-neg99.9%
Simplified99.9%
flip3--65.8%
associate-*l/65.8%
metadata-eval65.8%
sub-neg65.8%
metadata-eval65.8%
+-commutative65.8%
fma-define65.9%
metadata-eval65.9%
*-rgt-identity65.9%
Applied egg-rr65.9%
Taylor expanded in z around 0 54.7%
Taylor expanded in y around inf 2.8%
Final simplification2.8%
herbie shell --seed 2024039
(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))