
(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 Float64(fma(Float64(z + -1.0), log1p(Float64(-y)), Float64(log(y) * Float64(-1.0 + x))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Initial program 91.1%
+-commutative91.1%
fma-def91.1%
sub-neg91.1%
metadata-eval91.1%
sub-neg91.1%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (fma (- y) (+ z -1.0) (fma (log y) (+ -1.0 x) (- t))))
double code(double x, double y, double z, double t) {
return fma(-y, (z + -1.0), fma(log(y), (-1.0 + x), -t));
}
function code(x, y, z, t) return fma(Float64(-y), Float64(z + -1.0), fma(log(y), Float64(-1.0 + x), Float64(-t))) end
code[x_, y_, z_, t_] := N[((-y) * N[(z + -1.0), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-y, z + -1, \mathsf{fma}\left(\log y, -1 + x, -t\right)\right)
\end{array}
Initial program 91.1%
+-commutative91.1%
fma-def91.1%
sub-neg91.1%
metadata-eval91.1%
sub-neg91.1%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
associate-+r-99.4%
sub-neg99.4%
metadata-eval99.4%
associate-*r*99.4%
fma-def99.4%
mul-1-neg99.4%
+-commutative99.4%
*-commutative99.4%
fma-neg99.4%
+-commutative99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.25e+58) (not (<= x 4.6))) (- (* (log y) (+ -1.0 x)) t) (- (- (- y (* z y)) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.25e+58) || !(x <= 4.6)) {
tmp = (log(y) * (-1.0 + x)) - t;
} else {
tmp = ((y - (z * 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 <= (-4.25d+58)) .or. (.not. (x <= 4.6d0))) then
tmp = (log(y) * ((-1.0d0) + x)) - t
else
tmp = ((y - (z * 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 <= -4.25e+58) || !(x <= 4.6)) {
tmp = (Math.log(y) * (-1.0 + x)) - t;
} else {
tmp = ((y - (z * y)) - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.25e+58) or not (x <= 4.6): tmp = (math.log(y) * (-1.0 + x)) - t else: tmp = ((y - (z * y)) - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.25e+58) || !(x <= 4.6)) tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); else tmp = Float64(Float64(Float64(y - Float64(z * y)) - log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.25e+58) || ~((x <= 4.6))) tmp = (log(y) * (-1.0 + x)) - t; else tmp = ((y - (z * y)) - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.25e+58], N[Not[LessEqual[x, 4.6]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(y - N[(z * y), $MachinePrecision]), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.25 \cdot 10^{+58} \lor \neg \left(x \leq 4.6\right):\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y - z \cdot y\right) - \log y\right) - t\\
\end{array}
\end{array}
if x < -4.25000000000000007e58 or 4.5999999999999996 < x Initial program 95.8%
+-commutative95.8%
fma-def95.8%
sub-neg95.8%
metadata-eval95.8%
sub-neg95.8%
log1p-def99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around 0 95.8%
if -4.25000000000000007e58 < x < 4.5999999999999996Initial program 86.6%
Taylor expanded in y around 0 99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
*-commutative99.2%
mul-1-neg99.2%
unsub-neg99.2%
*-commutative99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in x around 0 96.2%
sub-neg96.2%
mul-1-neg96.2%
+-commutative96.2%
mul-1-neg96.2%
unsub-neg96.2%
mul-1-neg96.2%
sub-neg96.2%
metadata-eval96.2%
+-commutative96.2%
distribute-rgt-in96.2%
neg-mul-196.2%
*-commutative96.2%
distribute-neg-in96.2%
remove-double-neg96.2%
unsub-neg96.2%
Simplified96.2%
Final simplification96.0%
(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.1%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
mul-1-neg99.4%
unsub-neg99.4%
*-commutative99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (- (- (* (log y) (+ -1.0 x)) (* z y)) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) - (z * y)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((log(y) * ((-1.0d0) + x)) - (z * y)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (-1.0 + x)) - (z * y)) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) - (z * y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) - Float64(z * y)) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (-1.0 + x)) - (z * y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(-1 + x\right) - z \cdot y\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
mul-1-neg99.4%
unsub-neg99.4%
*-commutative99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in z around inf 99.2%
Final simplification99.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.15e+21) (not (<= t 1.8e+18))) (- (- t) (* z y)) (* (log y) (+ -1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.15e+21) || !(t <= 1.8e+18)) {
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 <= (-1.15d+21)) .or. (.not. (t <= 1.8d+18))) 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 <= -1.15e+21) || !(t <= 1.8e+18)) {
tmp = -t - (z * y);
} else {
tmp = Math.log(y) * (-1.0 + x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.15e+21) or not (t <= 1.8e+18): 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 <= -1.15e+21) || !(t <= 1.8e+18)) 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 <= -1.15e+21) || ~((t <= 1.8e+18))) 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, -1.15e+21], N[Not[LessEqual[t, 1.8e+18]], $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 -1.15 \cdot 10^{+21} \lor \neg \left(t \leq 1.8 \cdot 10^{+18}\right):\\
\;\;\;\;\left(-t\right) - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right)\\
\end{array}
\end{array}
if t < -1.15e21 or 1.8e18 < t Initial program 92.6%
Taylor expanded in y around 0 99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
*-commutative99.9%
mul-1-neg99.9%
unsub-neg99.9%
*-commutative99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
distribute-lft-in99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 80.0%
associate-*r*80.0%
neg-mul-180.0%
Simplified80.0%
if -1.15e21 < t < 1.8e18Initial program 89.8%
+-commutative89.8%
fma-def89.8%
sub-neg89.8%
metadata-eval89.8%
sub-neg89.8%
log1p-def99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 88.5%
Taylor expanded in t around 0 85.6%
Final simplification83.1%
(FPCore (x y z t) :precision binary64 (if (<= z -1.25e+230) (- (- t) (* z y)) (- (* (log y) (+ -1.0 x)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.25e+230) {
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 <= (-1.25d+230)) 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 <= -1.25e+230) {
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 <= -1.25e+230: 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 <= -1.25e+230) 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 <= -1.25e+230) tmp = -t - (z * y); else tmp = (log(y) * (-1.0 + x)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.25e+230], 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 -1.25 \cdot 10^{+230}:\\
\;\;\;\;\left(-t\right) - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\end{array}
\end{array}
if z < -1.2500000000000001e230Initial program 48.4%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
*-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
distribute-lft-in99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 84.1%
associate-*r*84.1%
neg-mul-184.1%
Simplified84.1%
if -1.2500000000000001e230 < z Initial program 93.7%
+-commutative93.7%
fma-def93.7%
sub-neg93.7%
metadata-eval93.7%
sub-neg93.7%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 92.9%
Final simplification92.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.8e+205) (not (<= z 1.5e+136))) (- (- t) (* z y)) (- (- t) (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.8e+205) || !(z <= 1.5e+136)) {
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 <= (-5.8d+205)) .or. (.not. (z <= 1.5d+136))) 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 <= -5.8e+205) || !(z <= 1.5e+136)) {
tmp = -t - (z * y);
} else {
tmp = -t - Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.8e+205) or not (z <= 1.5e+136): tmp = -t - (z * y) else: tmp = -t - math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.8e+205) || !(z <= 1.5e+136)) 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 <= -5.8e+205) || ~((z <= 1.5e+136))) tmp = -t - (z * y); else tmp = -t - log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.8e+205], N[Not[LessEqual[z, 1.5e+136]], $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 -5.8 \cdot 10^{+205} \lor \neg \left(z \leq 1.5 \cdot 10^{+136}\right):\\
\;\;\;\;\left(-t\right) - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \log y\\
\end{array}
\end{array}
if z < -5.8000000000000003e205 or 1.49999999999999989e136 < z Initial program 64.4%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
*-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
distribute-lft-in99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 69.0%
associate-*r*69.0%
neg-mul-169.0%
Simplified69.0%
if -5.8000000000000003e205 < z < 1.49999999999999989e136Initial program 97.2%
+-commutative97.2%
fma-def97.2%
sub-neg97.2%
metadata-eval97.2%
sub-neg97.2%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 96.3%
Taylor expanded in x around 0 59.1%
mul-1-neg59.1%
Simplified59.1%
Final simplification60.9%
(FPCore (x y z t) :precision binary64 (- (* z (- (* -0.5 (* y y)) y)) t))
double code(double x, double y, double z, double t) {
return (z * ((-0.5 * (y * y)) - y)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (z * (((-0.5d0) * (y * y)) - y)) - t
end function
public static double code(double x, double y, double z, double t) {
return (z * ((-0.5 * (y * y)) - y)) - t;
}
def code(x, y, z, t): return (z * ((-0.5 * (y * y)) - y)) - t
function code(x, y, z, t) return Float64(Float64(z * Float64(Float64(-0.5 * Float64(y * y)) - y)) - t) end
function tmp = code(x, y, z, t) tmp = (z * ((-0.5 * (y * y)) - y)) - t; end
code[x_, y_, z_, t_] := N[(N[(z * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in z around inf 35.4%
*-commutative35.4%
sub-neg35.4%
mul-1-neg35.4%
log1p-def43.8%
mul-1-neg43.8%
Simplified43.8%
Taylor expanded in y around 0 43.6%
associate-*r*43.6%
associate-*r*43.6%
distribute-rgt-out43.6%
mul-1-neg43.6%
unpow243.6%
Simplified43.6%
Final simplification43.6%
(FPCore (x y z t) :precision binary64 (if (<= t -2.7e+16) (- t) (if (<= t 1.08e-16) (* y (- 1.0 z)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.7e+16) {
tmp = -t;
} else if (t <= 1.08e-16) {
tmp = y * (1.0 - z);
} 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) :: tmp
if (t <= (-2.7d+16)) then
tmp = -t
else if (t <= 1.08d-16) then
tmp = y * (1.0d0 - z)
else
tmp = -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.7e+16) {
tmp = -t;
} else if (t <= 1.08e-16) {
tmp = y * (1.0 - z);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.7e+16: tmp = -t elif t <= 1.08e-16: tmp = y * (1.0 - z) else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.7e+16) tmp = Float64(-t); elseif (t <= 1.08e-16) tmp = Float64(y * Float64(1.0 - z)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.7e+16) tmp = -t; elseif (t <= 1.08e-16) tmp = y * (1.0 - z); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.7e+16], (-t), If[LessEqual[t, 1.08e-16], N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.7 \cdot 10^{+16}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 1.08 \cdot 10^{-16}:\\
\;\;\;\;y \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -2.7e16 or 1.08e-16 < t Initial program 93.1%
+-commutative93.1%
fma-def93.1%
sub-neg93.1%
metadata-eval93.1%
sub-neg93.1%
log1p-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 69.0%
mul-1-neg69.0%
Simplified69.0%
if -2.7e16 < t < 1.08e-16Initial program 89.1%
+-commutative89.1%
fma-def89.1%
sub-neg89.1%
metadata-eval89.1%
sub-neg89.1%
log1p-def99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 99.0%
sub-neg99.0%
metadata-eval99.0%
*-commutative99.0%
associate-+r-99.0%
sub-neg99.0%
metadata-eval99.0%
associate-*r*99.0%
fma-def99.0%
mul-1-neg99.0%
+-commutative99.0%
*-commutative99.0%
fma-neg99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in y around inf 13.4%
mul-1-neg13.4%
sub-neg13.4%
metadata-eval13.4%
+-commutative13.4%
distribute-rgt-neg-in13.4%
distribute-neg-in13.4%
metadata-eval13.4%
sub-neg13.4%
Simplified13.4%
Final simplification40.3%
(FPCore (x y z t) :precision binary64 (if (<= t -2.9e+16) (- t) (if (<= t 1.08e-16) (* z (- y)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.9e+16) {
tmp = -t;
} else if (t <= 1.08e-16) {
tmp = z * -y;
} 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) :: tmp
if (t <= (-2.9d+16)) then
tmp = -t
else if (t <= 1.08d-16) then
tmp = z * -y
else
tmp = -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.9e+16) {
tmp = -t;
} else if (t <= 1.08e-16) {
tmp = z * -y;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.9e+16: tmp = -t elif t <= 1.08e-16: tmp = z * -y else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.9e+16) tmp = Float64(-t); elseif (t <= 1.08e-16) tmp = Float64(z * Float64(-y)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.9e+16) tmp = -t; elseif (t <= 1.08e-16) tmp = z * -y; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.9e+16], (-t), If[LessEqual[t, 1.08e-16], N[(z * (-y)), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{+16}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 1.08 \cdot 10^{-16}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -2.9e16 or 1.08e-16 < t Initial program 93.1%
+-commutative93.1%
fma-def93.1%
sub-neg93.1%
metadata-eval93.1%
sub-neg93.1%
log1p-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 69.0%
mul-1-neg69.0%
Simplified69.0%
if -2.9e16 < t < 1.08e-16Initial program 89.1%
+-commutative89.1%
fma-def89.1%
sub-neg89.1%
metadata-eval89.1%
sub-neg89.1%
log1p-def99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 99.0%
sub-neg99.0%
metadata-eval99.0%
*-commutative99.0%
associate-+r-99.0%
sub-neg99.0%
metadata-eval99.0%
associate-*r*99.0%
fma-def99.0%
mul-1-neg99.0%
+-commutative99.0%
*-commutative99.0%
fma-neg99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in z around inf 12.9%
associate-*r*12.9%
neg-mul-112.9%
Simplified12.9%
Final simplification40.0%
(FPCore (x y z t) :precision binary64 (- (- y (* z y)) t))
double code(double x, double y, double z, double t) {
return (y - (z * y)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (y - (z * y)) - t
end function
public static double code(double x, double y, double z, double t) {
return (y - (z * y)) - t;
}
def code(x, y, z, t): return (y - (z * y)) - t
function code(x, y, z, t) return Float64(Float64(y - Float64(z * y)) - t) end
function tmp = code(x, y, z, t) tmp = (y - (z * y)) - t; end
code[x_, y_, z_, t_] := N[(N[(y - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(y - z \cdot y\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
mul-1-neg99.4%
unsub-neg99.4%
*-commutative99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
Simplified99.4%
distribute-lft-in99.4%
Applied egg-rr99.4%
Taylor expanded in y around inf 43.6%
sub-neg43.6%
metadata-eval43.6%
distribute-neg-in43.6%
distribute-rgt-neg-out43.6%
neg-sub043.6%
distribute-lft-in43.6%
*-commutative43.6%
associate--r+43.6%
neg-sub043.6%
neg-mul-143.6%
remove-double-neg43.6%
Simplified43.6%
Final simplification43.6%
(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 91.1%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
mul-1-neg99.4%
unsub-neg99.4%
*-commutative99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
Simplified99.4%
distribute-lft-in99.4%
Applied egg-rr99.4%
Taylor expanded in z around inf 43.4%
associate-*r*43.4%
neg-mul-143.4%
Simplified43.4%
Final simplification43.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.1%
+-commutative91.1%
fma-def91.1%
sub-neg91.1%
metadata-eval91.1%
sub-neg91.1%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in t around inf 34.9%
mul-1-neg34.9%
Simplified34.9%
Final simplification34.9%
(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.1%
+-commutative91.1%
fma-def91.1%
sub-neg91.1%
metadata-eval91.1%
sub-neg91.1%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
associate-+r-99.4%
sub-neg99.4%
metadata-eval99.4%
associate-*r*99.4%
fma-def99.4%
mul-1-neg99.4%
+-commutative99.4%
*-commutative99.4%
fma-neg99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in y around inf 11.1%
mul-1-neg11.1%
sub-neg11.1%
metadata-eval11.1%
+-commutative11.1%
distribute-rgt-neg-in11.1%
distribute-neg-in11.1%
metadata-eval11.1%
sub-neg11.1%
Simplified11.1%
Taylor expanded in z around 0 2.9%
Final simplification2.9%
herbie shell --seed 2023290
(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))