
(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)) (- (* (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 91.2%
sub-neg91.2%
+-commutative91.2%
associate-+l+91.2%
fma-def91.2%
sub-neg91.2%
metadata-eval91.2%
sub-neg91.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
(let* ((t_1 (* (log y) (+ -1.0 x))))
(if (<= (+ -1.0 x) -1.0002)
(- (+ y t_1) t)
(if (<= (+ -1.0 x) -0.5)
(- (- t) (+ (log y) (* y (+ z -1.0))))
(- t_1 t)))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * (-1.0 + x);
double tmp;
if ((-1.0 + x) <= -1.0002) {
tmp = (y + t_1) - t;
} else if ((-1.0 + x) <= -0.5) {
tmp = -t - (log(y) + (y * (z + -1.0)));
} else {
tmp = 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 = log(y) * ((-1.0d0) + x)
if (((-1.0d0) + x) <= (-1.0002d0)) then
tmp = (y + t_1) - t
else if (((-1.0d0) + x) <= (-0.5d0)) then
tmp = -t - (log(y) + (y * (z + (-1.0d0))))
else
tmp = t_1 - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.log(y) * (-1.0 + x);
double tmp;
if ((-1.0 + x) <= -1.0002) {
tmp = (y + t_1) - t;
} else if ((-1.0 + x) <= -0.5) {
tmp = -t - (Math.log(y) + (y * (z + -1.0)));
} else {
tmp = t_1 - t;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * (-1.0 + x) tmp = 0 if (-1.0 + x) <= -1.0002: tmp = (y + t_1) - t elif (-1.0 + x) <= -0.5: tmp = -t - (math.log(y) + (y * (z + -1.0))) else: tmp = t_1 - t return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * Float64(-1.0 + x)) tmp = 0.0 if (Float64(-1.0 + x) <= -1.0002) tmp = Float64(Float64(y + t_1) - t); elseif (Float64(-1.0 + x) <= -0.5) tmp = Float64(Float64(-t) - Float64(log(y) + Float64(y * Float64(z + -1.0)))); else tmp = Float64(t_1 - t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * (-1.0 + x); tmp = 0.0; if ((-1.0 + x) <= -1.0002) tmp = (y + t_1) - t; elseif ((-1.0 + x) <= -0.5) tmp = -t - (log(y) + (y * (z + -1.0))); else tmp = t_1 - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(-1.0 + x), $MachinePrecision], -1.0002], N[(N[(y + t$95$1), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(-1.0 + x), $MachinePrecision], -0.5], N[((-t) - N[(N[Log[y], $MachinePrecision] + N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 - t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot \left(-1 + x\right)\\
\mathbf{if}\;-1 + x \leq -1.0002:\\
\;\;\;\;\left(y + t_1\right) - t\\
\mathbf{elif}\;-1 + x \leq -0.5:\\
\;\;\;\;\left(-t\right) - \left(\log y + y \cdot \left(z + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -1.0002Initial program 95.5%
Taylor expanded in y around 0 98.5%
mul-1-neg98.5%
Simplified98.5%
Taylor expanded in z around 0 94.2%
if -1.0002 < (-.f64 x 1) < -0.5Initial program 86.6%
Taylor expanded in y around 0 99.3%
mul-1-neg99.3%
Simplified99.3%
Taylor expanded in x around 0 99.2%
mul-1-neg99.2%
sub-neg99.2%
metadata-eval99.2%
unsub-neg99.2%
mul-1-neg99.2%
+-commutative99.2%
Simplified99.2%
if -0.5 < (-.f64 x 1) Initial program 95.4%
Taylor expanded in y around 0 94.4%
Final simplification96.7%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ -1.0 x) -1.0002) (not (<= (+ -1.0 x) -0.5))) (- (* (log y) (+ -1.0 x)) t) (- (- t) (+ (log y) (* z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -1.0002) || !((-1.0 + x) <= -0.5)) {
tmp = (log(y) * (-1.0 + x)) - t;
} else {
tmp = -t - (log(y) + (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 ((((-1.0d0) + x) <= (-1.0002d0)) .or. (.not. (((-1.0d0) + x) <= (-0.5d0)))) then
tmp = (log(y) * ((-1.0d0) + x)) - t
else
tmp = -t - (log(y) + (z * 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) <= -1.0002) || !((-1.0 + x) <= -0.5)) {
tmp = (Math.log(y) * (-1.0 + x)) - t;
} else {
tmp = -t - (Math.log(y) + (z * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((-1.0 + x) <= -1.0002) or not ((-1.0 + x) <= -0.5): tmp = (math.log(y) * (-1.0 + x)) - t else: tmp = -t - (math.log(y) + (z * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(-1.0 + x) <= -1.0002) || !(Float64(-1.0 + x) <= -0.5)) tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); else tmp = Float64(Float64(-t) - Float64(log(y) + Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((-1.0 + x) <= -1.0002) || ~(((-1.0 + x) <= -0.5))) tmp = (log(y) * (-1.0 + x)) - t; else tmp = -t - (log(y) + (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(-1.0 + x), $MachinePrecision], -1.0002], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], -0.5]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[(N[Log[y], $MachinePrecision] + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -1.0002 \lor \neg \left(-1 + x \leq -0.5\right):\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \left(\log y + z \cdot y\right)\\
\end{array}
\end{array}
if (-.f64 x 1) < -1.0002 or -0.5 < (-.f64 x 1) Initial program 95.5%
Taylor expanded in y around 0 94.2%
if -1.0002 < (-.f64 x 1) < -0.5Initial program 86.6%
Taylor expanded in y around 0 99.3%
mul-1-neg99.3%
Simplified99.3%
sub-neg99.3%
metadata-eval99.3%
expm1-log1p-u98.8%
Applied egg-rr98.8%
Taylor expanded in x around 0 99.2%
mul-1-neg99.2%
log-rec99.2%
+-commutative99.2%
log-rec99.2%
unsub-neg99.2%
mul-1-neg99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
Simplified99.2%
Taylor expanded in z around inf 98.7%
mul-1-neg98.7%
distribute-rgt-neg-in98.7%
Simplified98.7%
Final simplification96.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) (+ -1.0 x))))
(if (<= (+ -1.0 x) -1.0002)
(- (+ y t_1) t)
(if (<= (+ -1.0 x) -0.5) (- (- t) (+ (log y) (* z y))) (- t_1 t)))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * (-1.0 + x);
double tmp;
if ((-1.0 + x) <= -1.0002) {
tmp = (y + t_1) - t;
} else if ((-1.0 + x) <= -0.5) {
tmp = -t - (log(y) + (z * y));
} else {
tmp = 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 = log(y) * ((-1.0d0) + x)
if (((-1.0d0) + x) <= (-1.0002d0)) then
tmp = (y + t_1) - t
else if (((-1.0d0) + x) <= (-0.5d0)) then
tmp = -t - (log(y) + (z * y))
else
tmp = t_1 - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.log(y) * (-1.0 + x);
double tmp;
if ((-1.0 + x) <= -1.0002) {
tmp = (y + t_1) - t;
} else if ((-1.0 + x) <= -0.5) {
tmp = -t - (Math.log(y) + (z * y));
} else {
tmp = t_1 - t;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * (-1.0 + x) tmp = 0 if (-1.0 + x) <= -1.0002: tmp = (y + t_1) - t elif (-1.0 + x) <= -0.5: tmp = -t - (math.log(y) + (z * y)) else: tmp = t_1 - t return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * Float64(-1.0 + x)) tmp = 0.0 if (Float64(-1.0 + x) <= -1.0002) tmp = Float64(Float64(y + t_1) - t); elseif (Float64(-1.0 + x) <= -0.5) tmp = Float64(Float64(-t) - Float64(log(y) + Float64(z * y))); else tmp = Float64(t_1 - t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * (-1.0 + x); tmp = 0.0; if ((-1.0 + x) <= -1.0002) tmp = (y + t_1) - t; elseif ((-1.0 + x) <= -0.5) tmp = -t - (log(y) + (z * y)); else tmp = t_1 - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(-1.0 + x), $MachinePrecision], -1.0002], N[(N[(y + t$95$1), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(-1.0 + x), $MachinePrecision], -0.5], N[((-t) - N[(N[Log[y], $MachinePrecision] + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 - t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot \left(-1 + x\right)\\
\mathbf{if}\;-1 + x \leq -1.0002:\\
\;\;\;\;\left(y + t_1\right) - t\\
\mathbf{elif}\;-1 + x \leq -0.5:\\
\;\;\;\;\left(-t\right) - \left(\log y + z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -1.0002Initial program 95.5%
Taylor expanded in y around 0 98.5%
mul-1-neg98.5%
Simplified98.5%
Taylor expanded in z around 0 94.2%
if -1.0002 < (-.f64 x 1) < -0.5Initial program 86.6%
Taylor expanded in y around 0 99.3%
mul-1-neg99.3%
Simplified99.3%
sub-neg99.3%
metadata-eval99.3%
expm1-log1p-u98.8%
Applied egg-rr98.8%
Taylor expanded in x around 0 99.2%
mul-1-neg99.2%
log-rec99.2%
+-commutative99.2%
log-rec99.2%
unsub-neg99.2%
mul-1-neg99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
Simplified99.2%
Taylor expanded in z around inf 98.7%
mul-1-neg98.7%
distribute-rgt-neg-in98.7%
Simplified98.7%
if -0.5 < (-.f64 x 1) Initial program 95.4%
Taylor expanded in y around 0 94.4%
Final simplification96.4%
(FPCore (x y z t) :precision binary64 (- (- (* (log y) (+ -1.0 x)) (* y (+ z -1.0))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) - (y * (z + -1.0))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((log(y) * ((-1.0d0) + x)) - (y * (z + (-1.0d0)))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (-1.0 + x)) - (y * (z + -1.0))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) - (y * (z + -1.0))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) - Float64(y * Float64(z + -1.0))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (-1.0 + x)) - (y * (z + -1.0))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(-1 + x\right) - y \cdot \left(z + -1\right)\right) - t
\end{array}
Initial program 91.2%
Taylor expanded in y around 0 99.1%
mul-1-neg99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= t -3.3e+72)
(- t)
(if (<= t -4.4e-101)
t_1
(if (<= t 8.2e-302) (- (log y)) (if (<= t 6e+126) t_1 (- t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (t <= -3.3e+72) {
tmp = -t;
} else if (t <= -4.4e-101) {
tmp = t_1;
} else if (t <= 8.2e-302) {
tmp = -log(y);
} else if (t <= 6e+126) {
tmp = t_1;
} else {
tmp = -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 = x * log(y)
if (t <= (-3.3d+72)) then
tmp = -t
else if (t <= (-4.4d-101)) then
tmp = t_1
else if (t <= 8.2d-302) then
tmp = -log(y)
else if (t <= 6d+126) then
tmp = t_1
else
tmp = -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * Math.log(y);
double tmp;
if (t <= -3.3e+72) {
tmp = -t;
} else if (t <= -4.4e-101) {
tmp = t_1;
} else if (t <= 8.2e-302) {
tmp = -Math.log(y);
} else if (t <= 6e+126) {
tmp = t_1;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if t <= -3.3e+72: tmp = -t elif t <= -4.4e-101: tmp = t_1 elif t <= 8.2e-302: tmp = -math.log(y) elif t <= 6e+126: tmp = t_1 else: tmp = -t return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if (t <= -3.3e+72) tmp = Float64(-t); elseif (t <= -4.4e-101) tmp = t_1; elseif (t <= 8.2e-302) tmp = Float64(-log(y)); elseif (t <= 6e+126) tmp = t_1; else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if (t <= -3.3e+72) tmp = -t; elseif (t <= -4.4e-101) tmp = t_1; elseif (t <= 8.2e-302) tmp = -log(y); elseif (t <= 6e+126) tmp = t_1; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.3e+72], (-t), If[LessEqual[t, -4.4e-101], t$95$1, If[LessEqual[t, 8.2e-302], (-N[Log[y], $MachinePrecision]), If[LessEqual[t, 6e+126], t$95$1, (-t)]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;t \leq -3.3 \cdot 10^{+72}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq -4.4 \cdot 10^{-101}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 8.2 \cdot 10^{-302}:\\
\;\;\;\;-\log y\\
\mathbf{elif}\;t \leq 6 \cdot 10^{+126}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -3.3e72 or 6.0000000000000005e126 < t Initial program 97.8%
Taylor expanded in t around inf 79.6%
neg-mul-179.6%
Simplified79.6%
if -3.3e72 < t < -4.3999999999999998e-101 or 8.1999999999999996e-302 < t < 6.0000000000000005e126Initial program 86.9%
Taylor expanded in y around 0 99.5%
mul-1-neg99.5%
Simplified99.5%
Taylor expanded in x around inf 57.0%
*-commutative57.0%
Simplified57.0%
if -4.3999999999999998e-101 < t < 8.1999999999999996e-302Initial program 88.9%
Taylor expanded in y around 0 85.8%
Taylor expanded in x around 0 55.0%
mul-1-neg55.0%
Simplified55.0%
Taylor expanded in t around 0 55.0%
mul-1-neg55.0%
Simplified55.0%
Final simplification64.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.0) (not (<= x 2.1e-14))) (- (* x (log y)) t) (- (- t) (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.0) || !(x <= 2.1e-14)) {
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 <= (-1.0d0)) .or. (.not. (x <= 2.1d-14))) 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 <= -1.0) || !(x <= 2.1e-14)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = -t - Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.0) or not (x <= 2.1e-14): 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 <= -1.0) || !(x <= 2.1e-14)) 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 <= -1.0) || ~((x <= 2.1e-14))) tmp = (x * log(y)) - t; else tmp = -t - log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 2.1e-14]], $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 -1 \lor \neg \left(x \leq 2.1 \cdot 10^{-14}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \log y\\
\end{array}
\end{array}
if x < -1 or 2.0999999999999999e-14 < x Initial program 94.8%
Taylor expanded in y around 0 93.6%
*-commutative93.6%
sub-neg93.6%
metadata-eval93.6%
flip-+46.7%
associate-*l/46.6%
metadata-eval46.6%
fma-neg46.6%
metadata-eval46.6%
sub-neg46.6%
metadata-eval46.6%
Applied egg-rr46.6%
Taylor expanded in x around inf 93.1%
*-commutative93.1%
Simplified93.1%
if -1 < x < 2.0999999999999999e-14Initial program 87.3%
Taylor expanded in y around 0 85.9%
Taylor expanded in x around 0 85.4%
mul-1-neg85.4%
Simplified85.4%
Final simplification89.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.0) (not (<= x 2.1e-14))) (- (* x (log y)) t) (- (- y (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.0) || !(x <= 2.1e-14)) {
tmp = (x * log(y)) - t;
} else {
tmp = (y - log(y)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.0d0)) .or. (.not. (x <= 2.1d-14))) then
tmp = (x * log(y)) - t
else
tmp = (y - log(y)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.0) || !(x <= 2.1e-14)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = (y - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.0) or not (x <= 2.1e-14): tmp = (x * math.log(y)) - t else: tmp = (y - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.0) || !(x <= 2.1e-14)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(y - log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.0) || ~((x <= 2.1e-14))) tmp = (x * log(y)) - t; else tmp = (y - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 2.1e-14]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 2.1 \cdot 10^{-14}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(y - \log y\right) - t\\
\end{array}
\end{array}
if x < -1 or 2.0999999999999999e-14 < x Initial program 94.8%
Taylor expanded in y around 0 93.6%
*-commutative93.6%
sub-neg93.6%
metadata-eval93.6%
flip-+46.7%
associate-*l/46.6%
metadata-eval46.6%
fma-neg46.6%
metadata-eval46.6%
sub-neg46.6%
metadata-eval46.6%
Applied egg-rr46.6%
Taylor expanded in x around inf 93.1%
*-commutative93.1%
Simplified93.1%
if -1 < x < 2.0999999999999999e-14Initial program 87.3%
Taylor expanded in y around 0 99.3%
mul-1-neg99.3%
Simplified99.3%
sub-neg99.3%
metadata-eval99.3%
expm1-log1p-u98.8%
Applied egg-rr98.8%
Taylor expanded in x around 0 98.7%
mul-1-neg98.7%
log-rec98.7%
+-commutative98.7%
log-rec98.7%
unsub-neg98.7%
mul-1-neg98.7%
sub-neg98.7%
metadata-eval98.7%
+-commutative98.7%
*-commutative98.7%
distribute-rgt-neg-in98.7%
Simplified98.7%
Taylor expanded in z around 0 86.0%
Final simplification89.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.55e+48) (not (<= x 1.65e+14))) (* x (log y)) (- (- t) (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.55e+48) || !(x <= 1.65e+14)) {
tmp = x * log(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 ((x <= (-1.55d+48)) .or. (.not. (x <= 1.65d+14))) then
tmp = x * log(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 ((x <= -1.55e+48) || !(x <= 1.65e+14)) {
tmp = x * Math.log(y);
} else {
tmp = -t - Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.55e+48) or not (x <= 1.65e+14): tmp = x * math.log(y) else: tmp = -t - math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.55e+48) || !(x <= 1.65e+14)) tmp = Float64(x * log(y)); else tmp = Float64(Float64(-t) - log(y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.55e+48) || ~((x <= 1.65e+14))) tmp = x * log(y); else tmp = -t - log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.55e+48], N[Not[LessEqual[x, 1.65e+14]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{+48} \lor \neg \left(x \leq 1.65 \cdot 10^{+14}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \log y\\
\end{array}
\end{array}
if x < -1.55000000000000003e48 or 1.65e14 < x Initial program 95.7%
Taylor expanded in y around 0 98.7%
mul-1-neg98.7%
Simplified98.7%
Taylor expanded in x around inf 76.9%
*-commutative76.9%
Simplified76.9%
if -1.55000000000000003e48 < x < 1.65e14Initial program 87.4%
Taylor expanded in y around 0 86.1%
Taylor expanded in x around 0 83.1%
mul-1-neg83.1%
Simplified83.1%
Final simplification80.3%
(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 91.2%
Taylor expanded in y around 0 89.9%
Final simplification89.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -0.00245) (not (<= t 5.2e-9))) (- t) (- (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -0.00245) || !(t <= 5.2e-9)) {
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 <= (-0.00245d0)) .or. (.not. (t <= 5.2d-9))) 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 <= -0.00245) || !(t <= 5.2e-9)) {
tmp = -t;
} else {
tmp = -Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -0.00245) or not (t <= 5.2e-9): tmp = -t else: tmp = -math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -0.00245) || !(t <= 5.2e-9)) 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 <= -0.00245) || ~((t <= 5.2e-9))) tmp = -t; else tmp = -log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -0.00245], N[Not[LessEqual[t, 5.2e-9]], $MachinePrecision]], (-t), (-N[Log[y], $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.00245 \lor \neg \left(t \leq 5.2 \cdot 10^{-9}\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;-\log y\\
\end{array}
\end{array}
if t < -0.0024499999999999999 or 5.2000000000000002e-9 < t Initial program 92.8%
Taylor expanded in t around inf 61.0%
neg-mul-161.0%
Simplified61.0%
if -0.0024499999999999999 < t < 5.2000000000000002e-9Initial program 89.3%
Taylor expanded in y around 0 87.7%
Taylor expanded in x around 0 43.2%
mul-1-neg43.2%
Simplified43.2%
Taylor expanded in t around 0 43.1%
mul-1-neg43.1%
Simplified43.1%
Final simplification52.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -37000.0) (not (<= t 30000000000000.0))) (- t) (- y (* z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -37000.0) || !(t <= 30000000000000.0)) {
tmp = -t;
} else {
tmp = y - (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 <= (-37000.0d0)) .or. (.not. (t <= 30000000000000.0d0))) then
tmp = -t
else
tmp = y - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -37000.0) || !(t <= 30000000000000.0)) {
tmp = -t;
} else {
tmp = y - (z * y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -37000.0) or not (t <= 30000000000000.0): tmp = -t else: tmp = y - (z * y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -37000.0) || !(t <= 30000000000000.0)) tmp = Float64(-t); else tmp = Float64(y - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -37000.0) || ~((t <= 30000000000000.0))) tmp = -t; else tmp = y - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -37000.0], N[Not[LessEqual[t, 30000000000000.0]], $MachinePrecision]], (-t), N[(y - N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -37000 \lor \neg \left(t \leq 30000000000000\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;y - z \cdot y\\
\end{array}
\end{array}
if t < -37000 or 3e13 < t Initial program 95.1%
Taylor expanded in t around inf 64.6%
neg-mul-164.6%
Simplified64.6%
if -37000 < t < 3e13Initial program 87.2%
Taylor expanded in y around 0 99.0%
mul-1-neg99.0%
Simplified99.0%
sub-neg99.0%
metadata-eval99.0%
expm1-log1p-u73.5%
Applied egg-rr73.5%
Taylor expanded in y around inf 15.9%
mul-1-neg15.9%
sub-neg15.9%
metadata-eval15.9%
+-commutative15.9%
*-commutative15.9%
distribute-rgt-neg-in15.9%
Simplified15.9%
Taylor expanded in z around 0 15.9%
mul-1-neg15.9%
unsub-neg15.9%
Simplified15.9%
Final simplification40.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -10200.0) (not (<= t 30000000000000.0))) (- t) (* z (- y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -10200.0) || !(t <= 30000000000000.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 <= (-10200.0d0)) .or. (.not. (t <= 30000000000000.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 <= -10200.0) || !(t <= 30000000000000.0)) {
tmp = -t;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -10200.0) or not (t <= 30000000000000.0): tmp = -t else: tmp = z * -y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -10200.0) || !(t <= 30000000000000.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 <= -10200.0) || ~((t <= 30000000000000.0))) tmp = -t; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -10200.0], N[Not[LessEqual[t, 30000000000000.0]], $MachinePrecision]], (-t), N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -10200 \lor \neg \left(t \leq 30000000000000\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if t < -10200 or 3e13 < t Initial program 95.1%
Taylor expanded in t around inf 64.6%
neg-mul-164.6%
Simplified64.6%
if -10200 < t < 3e13Initial program 87.2%
Taylor expanded in y around 0 99.0%
mul-1-neg99.0%
Simplified99.0%
Taylor expanded in z around inf 15.3%
mul-1-neg15.3%
*-commutative15.3%
distribute-rgt-neg-in15.3%
Simplified15.3%
Final simplification40.4%
(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 91.2%
Taylor expanded in t around inf 34.3%
neg-mul-134.3%
Simplified34.3%
Final simplification34.3%
(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 91.2%
Taylor expanded in y around 0 99.1%
mul-1-neg99.1%
Simplified99.1%
sub-neg99.1%
metadata-eval99.1%
expm1-log1p-u72.6%
Applied egg-rr72.6%
Taylor expanded in y around inf 11.4%
mul-1-neg11.4%
sub-neg11.4%
metadata-eval11.4%
+-commutative11.4%
*-commutative11.4%
distribute-rgt-neg-in11.4%
Simplified11.4%
Taylor expanded in z around 0 2.8%
Final simplification2.8%
herbie shell --seed 2023310
(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))