
(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 14 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 87.2%
+-commutative87.2%
associate--l+87.2%
fma-def87.2%
sub-neg87.2%
metadata-eval87.2%
sub-neg87.2%
log1p-def99.8%
fma-neg99.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)) (- (* (log y) (+ -1.0 x)) t)))
double code(double x, double y, double z, double t) {
return fma((z + -1.0), log1p(-y), ((log(y) * (-1.0 + x)) - t));
}
function code(x, y, z, t) return fma(Float64(z + -1.0), log1p(Float64(-y)), Float64(Float64(log(y) * Float64(-1.0 + x)) - t)) end
code[x_, y_, z_, t_] := N[(N[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \log y \cdot \left(-1 + x\right) - t\right)
\end{array}
Initial program 87.2%
sub-neg87.2%
+-commutative87.2%
associate-+l+87.2%
fma-def87.2%
sub-neg87.2%
metadata-eval87.2%
sub-neg87.2%
log1p-def99.8%
sub-neg99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (+ (* z (log1p (- y))) (* (log y) (+ -1.0 x))) t))
double code(double x, double y, double z, double t) {
return ((z * log1p(-y)) + (log(y) * (-1.0 + x))) - t;
}
public static double code(double x, double y, double z, double t) {
return ((z * Math.log1p(-y)) + (Math.log(y) * (-1.0 + x))) - t;
}
def code(x, y, z, t): return ((z * math.log1p(-y)) + (math.log(y) * (-1.0 + x))) - t
function code(x, y, z, t) return Float64(Float64(Float64(z * log1p(Float64(-y))) + Float64(log(y) * Float64(-1.0 + x))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(z \cdot \mathsf{log1p}\left(-y\right) + \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Initial program 87.2%
Taylor expanded in z around inf 86.6%
*-commutative86.6%
sub-neg86.6%
mul-1-neg86.6%
log1p-def99.2%
mul-1-neg99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ -1.0 x) -100.0) (not (<= (+ -1.0 x) 5000000.0))) (- (* (log y) (+ -1.0 x)) t) (- (- (- (log y)) (* (+ z -1.0) y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -100.0) || !((-1.0 + x) <= 5000000.0)) {
tmp = (log(y) * (-1.0 + x)) - t;
} else {
tmp = (-log(y) - ((z + -1.0) * 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) <= (-100.0d0)) .or. (.not. (((-1.0d0) + x) <= 5000000.0d0))) then
tmp = (log(y) * ((-1.0d0) + x)) - t
else
tmp = (-log(y) - ((z + (-1.0d0)) * 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) <= -100.0) || !((-1.0 + x) <= 5000000.0)) {
tmp = (Math.log(y) * (-1.0 + x)) - t;
} else {
tmp = (-Math.log(y) - ((z + -1.0) * y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((-1.0 + x) <= -100.0) or not ((-1.0 + x) <= 5000000.0): tmp = (math.log(y) * (-1.0 + x)) - t else: tmp = (-math.log(y) - ((z + -1.0) * y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(-1.0 + x) <= -100.0) || !(Float64(-1.0 + x) <= 5000000.0)) tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); else tmp = Float64(Float64(Float64(-log(y)) - Float64(Float64(z + -1.0) * y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((-1.0 + x) <= -100.0) || ~(((-1.0 + x) <= 5000000.0))) tmp = (log(y) * (-1.0 + x)) - t; else tmp = (-log(y) - ((z + -1.0) * y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(-1.0 + x), $MachinePrecision], -100.0], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], 5000000.0]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[((-N[Log[y], $MachinePrecision]) - N[(N[(z + -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -100 \lor \neg \left(-1 + x \leq 5000000\right):\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-\log y\right) - \left(z + -1\right) \cdot y\right) - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -100 or 5e6 < (-.f64 x 1) Initial program 94.3%
Taylor expanded in y around 0 93.8%
if -100 < (-.f64 x 1) < 5e6Initial program 79.9%
sub-neg79.9%
metadata-eval79.9%
flip-+79.9%
associate-*l/79.9%
metadata-eval79.9%
fma-neg79.9%
metadata-eval79.9%
sub-neg79.9%
metadata-eval79.9%
+-commutative79.9%
Applied egg-rr79.9%
Taylor expanded in y around 0 98.2%
mul-1-neg98.2%
Simplified98.2%
Taylor expanded in x around 0 97.8%
mul-1-neg97.8%
sub-neg97.8%
metadata-eval97.8%
unsub-neg97.8%
mul-1-neg97.8%
+-commutative97.8%
Simplified97.8%
Final simplification95.8%
(FPCore (x y z t)
:precision binary64
(if (<= (+ -1.0 x) -100.0)
(- (- t) (* (+ -1.0 x) (log (/ 1.0 y))))
(if (<= (+ -1.0 x) 5000000.0)
(- (- (- (log y)) (* (+ z -1.0) y)) t)
(- (* (log y) (+ -1.0 x)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((-1.0 + x) <= -100.0) {
tmp = -t - ((-1.0 + x) * log((1.0 / y)));
} else if ((-1.0 + x) <= 5000000.0) {
tmp = (-log(y) - ((z + -1.0) * y)) - t;
} 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) <= (-100.0d0)) then
tmp = -t - (((-1.0d0) + x) * log((1.0d0 / y)))
else if (((-1.0d0) + x) <= 5000000.0d0) then
tmp = (-log(y) - ((z + (-1.0d0)) * y)) - t
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) <= -100.0) {
tmp = -t - ((-1.0 + x) * Math.log((1.0 / y)));
} else if ((-1.0 + x) <= 5000000.0) {
tmp = (-Math.log(y) - ((z + -1.0) * y)) - t;
} else {
tmp = (Math.log(y) * (-1.0 + x)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (-1.0 + x) <= -100.0: tmp = -t - ((-1.0 + x) * math.log((1.0 / y))) elif (-1.0 + x) <= 5000000.0: tmp = (-math.log(y) - ((z + -1.0) * y)) - t 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) <= -100.0) tmp = Float64(Float64(-t) - Float64(Float64(-1.0 + x) * log(Float64(1.0 / y)))); elseif (Float64(-1.0 + x) <= 5000000.0) tmp = Float64(Float64(Float64(-log(y)) - Float64(Float64(z + -1.0) * y)) - t); 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) <= -100.0) tmp = -t - ((-1.0 + x) * log((1.0 / y))); elseif ((-1.0 + x) <= 5000000.0) tmp = (-log(y) - ((z + -1.0) * y)) - t; 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], -100.0], N[((-t) - N[(N[(-1.0 + x), $MachinePrecision] * N[Log[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(-1.0 + x), $MachinePrecision], 5000000.0], N[(N[((-N[Log[y], $MachinePrecision]) - N[(N[(z + -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - t), $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 -100:\\
\;\;\;\;\left(-t\right) - \left(-1 + x\right) \cdot \log \left(\frac{1}{y}\right)\\
\mathbf{elif}\;-1 + x \leq 5000000:\\
\;\;\;\;\left(\left(-\log y\right) - \left(z + -1\right) \cdot y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -100Initial program 91.7%
Taylor expanded in y around 0 90.6%
Taylor expanded in y around inf 90.6%
if -100 < (-.f64 x 1) < 5e6Initial program 79.9%
sub-neg79.9%
metadata-eval79.9%
flip-+79.9%
associate-*l/79.9%
metadata-eval79.9%
fma-neg79.9%
metadata-eval79.9%
sub-neg79.9%
metadata-eval79.9%
+-commutative79.9%
Applied egg-rr79.9%
Taylor expanded in y around 0 98.2%
mul-1-neg98.2%
Simplified98.2%
Taylor expanded in x around 0 97.8%
mul-1-neg97.8%
sub-neg97.8%
metadata-eval97.8%
unsub-neg97.8%
mul-1-neg97.8%
+-commutative97.8%
Simplified97.8%
if 5e6 < (-.f64 x 1) Initial program 96.9%
Taylor expanded in y around 0 96.9%
Final simplification95.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ -1.0 x) -3.5e+24) (not (<= (+ -1.0 x) 1.35e+122))) (* (log y) (+ -1.0 x)) (- (- t) (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -3.5e+24) || !((-1.0 + x) <= 1.35e+122)) {
tmp = log(y) * (-1.0 + x);
} 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 ((((-1.0d0) + x) <= (-3.5d+24)) .or. (.not. (((-1.0d0) + x) <= 1.35d+122))) then
tmp = log(y) * ((-1.0d0) + x)
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 (((-1.0 + x) <= -3.5e+24) || !((-1.0 + x) <= 1.35e+122)) {
tmp = Math.log(y) * (-1.0 + x);
} else {
tmp = -t - Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((-1.0 + x) <= -3.5e+24) or not ((-1.0 + x) <= 1.35e+122): tmp = math.log(y) * (-1.0 + x) else: tmp = -t - math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(-1.0 + x) <= -3.5e+24) || !(Float64(-1.0 + x) <= 1.35e+122)) tmp = Float64(log(y) * Float64(-1.0 + x)); else tmp = Float64(Float64(-t) - log(y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((-1.0 + x) <= -3.5e+24) || ~(((-1.0 + x) <= 1.35e+122))) tmp = log(y) * (-1.0 + x); else tmp = -t - log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(-1.0 + x), $MachinePrecision], -3.5e+24], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], 1.35e+122]], $MachinePrecision]], N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -3.5 \cdot 10^{+24} \lor \neg \left(-1 + x \leq 1.35 \cdot 10^{+122}\right):\\
\;\;\;\;\log y \cdot \left(-1 + x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \log y\\
\end{array}
\end{array}
if (-.f64 x 1) < -3.5000000000000002e24 or 1.3499999999999999e122 < (-.f64 x 1) Initial program 94.8%
Taylor expanded in y around 0 94.1%
Taylor expanded in t around 0 79.4%
if -3.5000000000000002e24 < (-.f64 x 1) < 1.3499999999999999e122Initial program 82.4%
Taylor expanded in y around 0 80.1%
Taylor expanded in x around 0 72.5%
mul-1-neg72.5%
Simplified72.5%
Final simplification75.2%
(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 87.2%
sub-neg87.2%
metadata-eval87.2%
flip-+64.5%
associate-*l/64.4%
metadata-eval64.4%
fma-neg64.4%
metadata-eval64.4%
sub-neg64.4%
metadata-eval64.4%
+-commutative64.4%
Applied egg-rr64.4%
Taylor expanded in y around 0 76.1%
mul-1-neg76.1%
Simplified76.1%
Taylor expanded in x around 0 98.8%
+-commutative98.8%
mul-1-neg98.8%
sub-neg98.8%
metadata-eval98.8%
unsub-neg98.8%
associate--l+98.8%
distribute-rgt-out98.8%
+-commutative98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7200000000.0) (not (<= t 4.1e-16))) (- (* x (log y)) t) (* (log y) (+ -1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7200000000.0) || !(t <= 4.1e-16)) {
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 <= (-7200000000.0d0)) .or. (.not. (t <= 4.1d-16))) 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 <= -7200000000.0) || !(t <= 4.1e-16)) {
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 <= -7200000000.0) or not (t <= 4.1e-16): 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 <= -7200000000.0) || !(t <= 4.1e-16)) 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 <= -7200000000.0) || ~((t <= 4.1e-16))) 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, -7200000000.0], N[Not[LessEqual[t, 4.1e-16]], $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 -7200000000 \lor \neg \left(t \leq 4.1 \cdot 10^{-16}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right)\\
\end{array}
\end{array}
if t < -7.2e9 or 4.10000000000000006e-16 < t Initial program 92.3%
Taylor expanded in y around 0 91.6%
Taylor expanded in x around inf 91.5%
if -7.2e9 < t < 4.10000000000000006e-16Initial program 82.2%
Taylor expanded in y around 0 79.5%
Taylor expanded in t around 0 79.1%
Final simplification85.3%
(FPCore (x y z t) :precision binary64 (- (+ y (* (log y) (+ -1.0 x))) t))
double code(double x, double y, double z, double t) {
return (y + (log(y) * (-1.0 + x))) - 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 + (log(y) * ((-1.0d0) + x))) - t
end function
public static double code(double x, double y, double z, double t) {
return (y + (Math.log(y) * (-1.0 + x))) - t;
}
def code(x, y, z, t): return (y + (math.log(y) * (-1.0 + x))) - t
function code(x, y, z, t) return Float64(Float64(y + Float64(log(y) * Float64(-1.0 + x))) - t) end
function tmp = code(x, y, z, t) tmp = (y + (log(y) * (-1.0 + x))) - t; end
code[x_, y_, z_, t_] := N[(N[(y + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(y + \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Initial program 87.2%
Taylor expanded in z around 0 86.2%
+-commutative86.2%
sub-neg86.2%
metadata-eval86.2%
fma-def86.2%
mul-1-neg86.2%
fma-neg86.2%
+-commutative86.2%
sub-neg86.2%
mul-1-neg86.2%
log1p-def86.2%
mul-1-neg86.2%
Simplified86.2%
Taylor expanded in y around 0 85.8%
Final simplification85.8%
(FPCore (x y z t) :precision binary64 (if (<= t -7200000000.0) (- t) (if (<= t 3.4e-5) (- (log y)) (- (log y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7200000000.0) {
tmp = -t;
} else if (t <= 3.4e-5) {
tmp = -log(y);
} 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 (t <= (-7200000000.0d0)) then
tmp = -t
else if (t <= 3.4d-5) then
tmp = -log(y)
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 (t <= -7200000000.0) {
tmp = -t;
} else if (t <= 3.4e-5) {
tmp = -Math.log(y);
} else {
tmp = Math.log(y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -7200000000.0: tmp = -t elif t <= 3.4e-5: tmp = -math.log(y) else: tmp = math.log(y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -7200000000.0) tmp = Float64(-t); elseif (t <= 3.4e-5) tmp = Float64(-log(y)); else tmp = Float64(log(y) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -7200000000.0) tmp = -t; elseif (t <= 3.4e-5) tmp = -log(y); else tmp = log(y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -7200000000.0], (-t), If[LessEqual[t, 3.4e-5], (-N[Log[y], $MachinePrecision]), N[(N[Log[y], $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7200000000:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{-5}:\\
\;\;\;\;-\log y\\
\mathbf{else}:\\
\;\;\;\;\log y - t\\
\end{array}
\end{array}
if t < -7.2e9Initial program 95.4%
Taylor expanded in t around inf 75.8%
mul-1-neg75.8%
Simplified75.8%
if -7.2e9 < t < 3.4e-5Initial program 82.4%
Taylor expanded in y around 0 79.8%
Taylor expanded in x around 0 33.8%
mul-1-neg33.8%
Simplified33.8%
Taylor expanded in t around 0 33.4%
mul-1-neg33.4%
Simplified33.4%
if 3.4e-5 < t Initial program 89.0%
Taylor expanded in z around 0 88.0%
+-commutative88.0%
sub-neg88.0%
metadata-eval88.0%
fma-def88.0%
mul-1-neg88.0%
fma-neg88.0%
+-commutative88.0%
sub-neg88.0%
mul-1-neg88.0%
log1p-def88.0%
mul-1-neg88.0%
Simplified88.0%
Taylor expanded in x around 0 61.9%
neg-mul-161.9%
Simplified61.9%
log1p-expm1-u61.9%
expm1-udef61.9%
exp-diff61.9%
add-sqr-sqrt61.9%
sqrt-unprod61.9%
sqr-neg61.9%
sqrt-unprod0.0%
add-sqr-sqrt10.6%
add-exp-log10.6%
log1p-udef10.6%
rem-exp-log10.6%
add-sqr-sqrt0.0%
sqrt-unprod10.6%
sqr-neg10.6%
sqrt-unprod10.6%
add-sqr-sqrt10.6%
Applied egg-rr10.6%
Taylor expanded in y around 0 62.0%
Final simplification50.8%
(FPCore (x y z t) :precision binary64 (- (* (log y) (+ -1.0 x)) t))
double code(double x, double y, double z, double t) {
return (log(y) * (-1.0 + x)) - 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)) - t
end function
public static double code(double x, double y, double z, double t) {
return (Math.log(y) * (-1.0 + x)) - t;
}
def code(x, y, z, t): return (math.log(y) * (-1.0 + x)) - t
function code(x, y, z, t) return Float64(Float64(log(y) * Float64(-1.0 + x)) - t) end
function tmp = code(x, y, z, t) tmp = (log(y) * (-1.0 + x)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\log y \cdot \left(-1 + x\right) - t
\end{array}
Initial program 87.2%
Taylor expanded in y around 0 85.5%
Final simplification85.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -7200000000.0) (not (<= t 3.4e-5))) (- t) (- (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -7200000000.0) || !(t <= 3.4e-5)) {
tmp = -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 <= (-7200000000.0d0)) .or. (.not. (t <= 3.4d-5))) then
tmp = -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 <= -7200000000.0) || !(t <= 3.4e-5)) {
tmp = -t;
} else {
tmp = -Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -7200000000.0) or not (t <= 3.4e-5): tmp = -t else: tmp = -math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -7200000000.0) || !(t <= 3.4e-5)) tmp = Float64(-t); else tmp = Float64(-log(y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -7200000000.0) || ~((t <= 3.4e-5))) tmp = -t; else tmp = -log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -7200000000.0], N[Not[LessEqual[t, 3.4e-5]], $MachinePrecision]], (-t), (-N[Log[y], $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7200000000 \lor \neg \left(t \leq 3.4 \cdot 10^{-5}\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;-\log y\\
\end{array}
\end{array}
if t < -7.2e9 or 3.4e-5 < t Initial program 92.1%
Taylor expanded in t around inf 68.7%
mul-1-neg68.7%
Simplified68.7%
if -7.2e9 < t < 3.4e-5Initial program 82.4%
Taylor expanded in y around 0 79.8%
Taylor expanded in x around 0 33.8%
mul-1-neg33.8%
Simplified33.8%
Taylor expanded in t around 0 33.4%
mul-1-neg33.4%
Simplified33.4%
Final simplification50.8%
(FPCore (x y z t) :precision binary64 (- (- t) (log y)))
double code(double x, double y, double z, double t) {
return -t - log(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 - log(y)
end function
public static double code(double x, double y, double z, double t) {
return -t - Math.log(y);
}
def code(x, y, z, t): return -t - math.log(y)
function code(x, y, z, t) return Float64(Float64(-t) - log(y)) end
function tmp = code(x, y, z, t) tmp = -t - log(y); end
code[x_, y_, z_, t_] := N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-t\right) - \log y
\end{array}
Initial program 87.2%
Taylor expanded in y around 0 85.5%
Taylor expanded in x around 0 51.0%
mul-1-neg51.0%
Simplified51.0%
Final simplification51.0%
(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.2%
Taylor expanded in t around inf 35.4%
mul-1-neg35.4%
Simplified35.4%
Final simplification35.4%
herbie shell --seed 2023312
(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))