
(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) (+ x -1.0)) t)))
double code(double x, double y, double z, double t) {
return fma((z + -1.0), log1p(-y), ((log(y) * (x + -1.0)) - t));
}
function code(x, y, z, t) return fma(Float64(z + -1.0), log1p(Float64(-y)), Float64(Float64(log(y) * Float64(x + -1.0)) - 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[(x + -1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \log y \cdot \left(x + -1\right) - t\right)
\end{array}
Initial program 86.9%
+-commutative86.9%
associate--l+86.9%
fma-def86.9%
sub-neg86.9%
log1p-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ x -1.0)) (* z (log1p (- y)))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) + (z * log1p(-y))) - t;
}
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) + (z * Math.log1p(-y))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) + (z * math.log1p(-y))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(z * log1p(Float64(-y)))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) + z \cdot \mathsf{log1p}\left(-y\right)\right) - t
\end{array}
Initial program 86.9%
Taylor expanded in z around inf 86.5%
*-commutative86.5%
sub-neg86.5%
mul-1-neg86.5%
log1p-def99.5%
mul-1-neg99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ x -1.0)) (* (+ z -1.0) (- (* y (* y -0.5)) y))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) + ((z + -1.0) * ((y * (y * -0.5)) - 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) * (x + (-1.0d0))) + ((z + (-1.0d0)) * ((y * (y * (-0.5d0))) - y))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) + ((z + -1.0) * ((y * (y * -0.5)) - y))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) + ((z + -1.0) * ((y * (y * -0.5)) - y))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(Float64(z + -1.0) * Float64(Float64(y * Float64(y * -0.5)) - y))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) + ((z + -1.0) * ((y * (y * -0.5)) - y))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(z + -1.0), $MachinePrecision] * N[(N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) + \left(z + -1\right) \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right)\right) - t
\end{array}
Initial program 86.9%
Taylor expanded in y around 0 99.4%
mul-1-neg99.4%
unsub-neg99.4%
unpow299.4%
associate-*r*99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ x -1.0)) (* z (- (* y (* y -0.5)) y))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) + (z * ((y * (y * -0.5)) - 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) * (x + (-1.0d0))) + (z * ((y * (y * (-0.5d0))) - y))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) + (z * ((y * (y * -0.5)) - y))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) + (z * ((y * (y * -0.5)) - y))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(z * Float64(Float64(y * Float64(y * -0.5)) - y))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) + (z * ((y * (y * -0.5)) - y))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(z * N[(N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) + z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right)\right) - t
\end{array}
Initial program 86.9%
Taylor expanded in z around inf 86.5%
*-commutative86.5%
sub-neg86.5%
mul-1-neg86.5%
log1p-def99.5%
mul-1-neg99.5%
Simplified99.5%
Taylor expanded in y around 0 99.2%
+-commutative99.2%
associate-*r*99.2%
associate-*r*99.2%
distribute-rgt-out99.2%
neg-mul-199.2%
unpow299.2%
associate-*r*99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t) :precision binary64 (- (- (* (log y) (+ x -1.0)) (* (+ z -1.0) y)) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) - ((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) * (x + (-1.0d0))) - ((z + (-1.0d0)) * y)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) - ((z + -1.0) * y)) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) - ((z + -1.0) * y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) - Float64(Float64(z + -1.0) * y)) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) - ((z + -1.0) * y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(z + -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) - \left(z + -1\right) \cdot y\right) - t
\end{array}
Initial program 86.9%
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 -2.75e+48)
(- t)
(if (<= t -1.05e-195)
t_1
(if (<= t -1.08e-287)
(* (+ z -1.0) (- (* -0.5 (* y y)) y))
(if (<= t 1.25e+69) t_1 (- t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (t <= -2.75e+48) {
tmp = -t;
} else if (t <= -1.05e-195) {
tmp = t_1;
} else if (t <= -1.08e-287) {
tmp = (z + -1.0) * ((-0.5 * (y * y)) - y);
} else if (t <= 1.25e+69) {
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 <= (-2.75d+48)) then
tmp = -t
else if (t <= (-1.05d-195)) then
tmp = t_1
else if (t <= (-1.08d-287)) then
tmp = (z + (-1.0d0)) * (((-0.5d0) * (y * y)) - y)
else if (t <= 1.25d+69) 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 <= -2.75e+48) {
tmp = -t;
} else if (t <= -1.05e-195) {
tmp = t_1;
} else if (t <= -1.08e-287) {
tmp = (z + -1.0) * ((-0.5 * (y * y)) - y);
} else if (t <= 1.25e+69) {
tmp = t_1;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if t <= -2.75e+48: tmp = -t elif t <= -1.05e-195: tmp = t_1 elif t <= -1.08e-287: tmp = (z + -1.0) * ((-0.5 * (y * y)) - y) elif t <= 1.25e+69: 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 <= -2.75e+48) tmp = Float64(-t); elseif (t <= -1.05e-195) tmp = t_1; elseif (t <= -1.08e-287) tmp = Float64(Float64(z + -1.0) * Float64(Float64(-0.5 * Float64(y * y)) - y)); elseif (t <= 1.25e+69) 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 <= -2.75e+48) tmp = -t; elseif (t <= -1.05e-195) tmp = t_1; elseif (t <= -1.08e-287) tmp = (z + -1.0) * ((-0.5 * (y * y)) - y); elseif (t <= 1.25e+69) 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, -2.75e+48], (-t), If[LessEqual[t, -1.05e-195], t$95$1, If[LessEqual[t, -1.08e-287], N[(N[(z + -1.0), $MachinePrecision] * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.25e+69], t$95$1, (-t)]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;t \leq -2.75 \cdot 10^{+48}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq -1.05 \cdot 10^{-195}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -1.08 \cdot 10^{-287}:\\
\;\;\;\;\left(z + -1\right) \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right)\\
\mathbf{elif}\;t \leq 1.25 \cdot 10^{+69}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -2.7500000000000001e48 or 1.25000000000000009e69 < t Initial program 97.2%
Taylor expanded in t around inf 80.0%
neg-mul-180.0%
Simplified80.0%
if -2.7500000000000001e48 < t < -1.05e-195 or -1.08e-287 < t < 1.25000000000000009e69Initial program 83.7%
Taylor expanded in z around inf 83.0%
*-commutative83.0%
sub-neg83.0%
mul-1-neg83.0%
log1p-def99.0%
mul-1-neg99.0%
Simplified99.0%
Taylor expanded in x around inf 46.5%
if -1.05e-195 < t < -1.08e-287Initial program 62.1%
Taylor expanded in y around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
unpow2100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in y around inf 43.8%
+-commutative43.8%
*-commutative43.8%
sub-neg43.8%
metadata-eval43.8%
associate-*l*43.8%
unpow243.8%
associate-*r*43.8%
mul-1-neg43.8%
sub-neg43.8%
metadata-eval43.8%
distribute-rgt-neg-in43.8%
distribute-lft-in43.9%
associate-*r*43.9%
unpow243.9%
*-commutative43.9%
sub-neg43.9%
unpow243.9%
Simplified43.9%
Final simplification59.2%
(FPCore (x y z t) :precision binary64 (if (<= z 1.25e+133) (- (+ y (* (log y) (+ x -1.0))) t) (- (* z (log1p (- y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.25e+133) {
tmp = (y + (log(y) * (x + -1.0))) - t;
} else {
tmp = (z * log1p(-y)) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.25e+133) {
tmp = (y + (Math.log(y) * (x + -1.0))) - t;
} else {
tmp = (z * Math.log1p(-y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 1.25e+133: tmp = (y + (math.log(y) * (x + -1.0))) - t else: tmp = (z * math.log1p(-y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 1.25e+133) tmp = Float64(Float64(y + Float64(log(y) * Float64(x + -1.0))) - t); else tmp = Float64(Float64(z * log1p(Float64(-y))) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.25e+133], N[(N[(y + N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.25 \cdot 10^{+133}:\\
\;\;\;\;\left(y + \log y \cdot \left(x + -1\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\end{array}
\end{array}
if z < 1.2499999999999999e133Initial program 93.9%
Taylor expanded in z around 0 93.4%
sub-neg93.4%
metadata-eval93.4%
mul-1-neg93.4%
unsub-neg93.4%
*-commutative93.4%
+-commutative93.4%
sub-neg93.4%
mul-1-neg93.4%
log1p-def93.4%
mul-1-neg93.4%
Simplified93.4%
Taylor expanded in y around 0 93.1%
if 1.2499999999999999e133 < z Initial program 46.6%
Taylor expanded in z around inf 46.6%
*-commutative46.6%
sub-neg46.6%
mul-1-neg46.6%
log1p-def100.0%
mul-1-neg100.0%
Simplified100.0%
*-commutative100.0%
flip--89.7%
associate-*r/89.7%
metadata-eval89.7%
fma-neg89.7%
metadata-eval89.7%
+-commutative89.7%
Applied egg-rr89.7%
associate-/l*89.7%
Simplified89.7%
Taylor expanded in x around inf 89.9%
Taylor expanded in x around 0 31.2%
sub-neg31.2%
log1p-def80.6%
Simplified80.6%
Final simplification91.3%
(FPCore (x y z t) :precision binary64 (- (- (* (log y) (+ x -1.0)) (* z y)) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) - (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) * (x + (-1.0d0))) - (z * y)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) - (z * y)) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) - (z * y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) - Float64(z * y)) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) - (z * y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) - z \cdot y\right) - t
\end{array}
Initial program 86.9%
Taylor expanded in z around inf 86.5%
*-commutative86.5%
sub-neg86.5%
mul-1-neg86.5%
log1p-def99.5%
mul-1-neg99.5%
Simplified99.5%
Taylor expanded in y around 0 99.2%
+-commutative99.2%
associate-*r*99.2%
associate-*r*99.2%
distribute-rgt-out99.2%
neg-mul-199.2%
unpow299.2%
associate-*r*99.2%
Simplified99.2%
Taylor expanded in y around 0 98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
mul-1-neg98.9%
unsub-neg98.9%
*-commutative98.9%
+-commutative98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -125000000000.0) (not (<= x 1.0))) (- (* x (log y)) t) (- (- t) (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -125000000000.0) || !(x <= 1.0)) {
tmp = (x * log(y)) - t;
} else {
tmp = -t - log(y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-125000000000.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = (x * log(y)) - t
else
tmp = -t - log(y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -125000000000.0) || !(x <= 1.0)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = -t - Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -125000000000.0) or not (x <= 1.0): tmp = (x * math.log(y)) - t else: tmp = -t - math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -125000000000.0) || !(x <= 1.0)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(-t) - log(y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -125000000000.0) || ~((x <= 1.0))) tmp = (x * log(y)) - t; else tmp = -t - log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -125000000000.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -125000000000 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \log y\\
\end{array}
\end{array}
if x < -1.25e11 or 1 < x Initial program 90.0%
Taylor expanded in y around 0 89.1%
Taylor expanded in x around inf 87.6%
if -1.25e11 < x < 1Initial program 83.9%
Taylor expanded in y around 0 82.4%
Taylor expanded in x around 0 81.9%
mul-1-neg81.9%
Simplified81.9%
Final simplification84.7%
(FPCore (x y z t) :precision binary64 (if (<= t -4.1e+48) (- t) (if (<= t 3.5e+66) (* (log y) (+ x -1.0)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.1e+48) {
tmp = -t;
} else if (t <= 3.5e+66) {
tmp = log(y) * (x + -1.0);
} 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 <= (-4.1d+48)) then
tmp = -t
else if (t <= 3.5d+66) then
tmp = log(y) * (x + (-1.0d0))
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 <= -4.1e+48) {
tmp = -t;
} else if (t <= 3.5e+66) {
tmp = Math.log(y) * (x + -1.0);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4.1e+48: tmp = -t elif t <= 3.5e+66: tmp = math.log(y) * (x + -1.0) else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4.1e+48) tmp = Float64(-t); elseif (t <= 3.5e+66) tmp = Float64(log(y) * Float64(x + -1.0)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -4.1e+48) tmp = -t; elseif (t <= 3.5e+66) tmp = log(y) * (x + -1.0); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.1e+48], (-t), If[LessEqual[t, 3.5e+66], N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.1 \cdot 10^{+48}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{+66}:\\
\;\;\;\;\log y \cdot \left(x + -1\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -4.1000000000000003e48 or 3.4999999999999997e66 < t Initial program 97.2%
Taylor expanded in t around inf 80.0%
neg-mul-180.0%
Simplified80.0%
if -4.1000000000000003e48 < t < 3.4999999999999997e66Initial program 80.4%
Taylor expanded in y around 0 78.5%
Taylor expanded in t around 0 74.1%
Final simplification76.4%
(FPCore (x y z t) :precision binary64 (if (<= z 1.25e+133) (- (* (log y) (+ x -1.0)) t) (- (* z (log1p (- y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.25e+133) {
tmp = (log(y) * (x + -1.0)) - t;
} else {
tmp = (z * log1p(-y)) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.25e+133) {
tmp = (Math.log(y) * (x + -1.0)) - t;
} else {
tmp = (z * Math.log1p(-y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 1.25e+133: tmp = (math.log(y) * (x + -1.0)) - t else: tmp = (z * math.log1p(-y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 1.25e+133) tmp = Float64(Float64(log(y) * Float64(x + -1.0)) - t); else tmp = Float64(Float64(z * log1p(Float64(-y))) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.25e+133], N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.25 \cdot 10^{+133}:\\
\;\;\;\;\log y \cdot \left(x + -1\right) - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\end{array}
\end{array}
if z < 1.2499999999999999e133Initial program 93.9%
Taylor expanded in y around 0 92.9%
if 1.2499999999999999e133 < z Initial program 46.6%
Taylor expanded in z around inf 46.6%
*-commutative46.6%
sub-neg46.6%
mul-1-neg46.6%
log1p-def100.0%
mul-1-neg100.0%
Simplified100.0%
*-commutative100.0%
flip--89.7%
associate-*r/89.7%
metadata-eval89.7%
fma-neg89.7%
metadata-eval89.7%
+-commutative89.7%
Applied egg-rr89.7%
associate-/l*89.7%
Simplified89.7%
Taylor expanded in x around inf 89.9%
Taylor expanded in x around 0 31.2%
sub-neg31.2%
log1p-def80.6%
Simplified80.6%
Final simplification91.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1350000000000.0) (not (<= x 1.9e+97))) (* x (log y)) (- (- t) (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1350000000000.0) || !(x <= 1.9e+97)) {
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 <= (-1350000000000.0d0)) .or. (.not. (x <= 1.9d+97))) 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 <= -1350000000000.0) || !(x <= 1.9e+97)) {
tmp = x * Math.log(y);
} else {
tmp = -t - Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1350000000000.0) or not (x <= 1.9e+97): tmp = x * math.log(y) else: tmp = -t - math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1350000000000.0) || !(x <= 1.9e+97)) 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 <= -1350000000000.0) || ~((x <= 1.9e+97))) tmp = x * log(y); else tmp = -t - log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1350000000000.0], N[Not[LessEqual[x, 1.9e+97]], $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 -1350000000000 \lor \neg \left(x \leq 1.9 \cdot 10^{+97}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \log y\\
\end{array}
\end{array}
if x < -1.35e12 or 1.90000000000000018e97 < x Initial program 91.9%
Taylor expanded in z around inf 91.9%
*-commutative91.9%
sub-neg91.9%
mul-1-neg91.9%
log1p-def99.7%
mul-1-neg99.7%
Simplified99.7%
Taylor expanded in x around inf 67.4%
if -1.35e12 < x < 1.90000000000000018e97Initial program 83.2%
Taylor expanded in y around 0 81.9%
Taylor expanded in x around 0 76.0%
mul-1-neg76.0%
Simplified76.0%
Final simplification72.4%
(FPCore (x y z t) :precision binary64 (if (<= t -1.55e+48) (- t) (if (<= t 1.4e+61) (* (+ z -1.0) (- (* -0.5 (* y y)) y)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.55e+48) {
tmp = -t;
} else if (t <= 1.4e+61) {
tmp = (z + -1.0) * ((-0.5 * (y * y)) - 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 <= (-1.55d+48)) then
tmp = -t
else if (t <= 1.4d+61) then
tmp = (z + (-1.0d0)) * (((-0.5d0) * (y * y)) - 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 <= -1.55e+48) {
tmp = -t;
} else if (t <= 1.4e+61) {
tmp = (z + -1.0) * ((-0.5 * (y * y)) - y);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.55e+48: tmp = -t elif t <= 1.4e+61: tmp = (z + -1.0) * ((-0.5 * (y * y)) - y) else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.55e+48) tmp = Float64(-t); elseif (t <= 1.4e+61) tmp = Float64(Float64(z + -1.0) * Float64(Float64(-0.5 * Float64(y * y)) - y)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.55e+48) tmp = -t; elseif (t <= 1.4e+61) tmp = (z + -1.0) * ((-0.5 * (y * y)) - y); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.55e+48], (-t), If[LessEqual[t, 1.4e+61], N[(N[(z + -1.0), $MachinePrecision] * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.55 \cdot 10^{+48}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 1.4 \cdot 10^{+61}:\\
\;\;\;\;\left(z + -1\right) \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -1.55000000000000003e48 or 1.4000000000000001e61 < t Initial program 97.3%
Taylor expanded in t around inf 77.8%
neg-mul-177.8%
Simplified77.8%
if -1.55000000000000003e48 < t < 1.4000000000000001e61Initial program 80.0%
Taylor expanded in y around 0 99.1%
mul-1-neg99.1%
unsub-neg99.1%
unpow299.1%
associate-*r*99.1%
Simplified99.1%
Taylor expanded in y around inf 23.0%
+-commutative23.0%
*-commutative23.0%
sub-neg23.0%
metadata-eval23.0%
associate-*l*23.0%
unpow223.0%
associate-*r*23.0%
mul-1-neg23.0%
sub-neg23.0%
metadata-eval23.0%
distribute-rgt-neg-in23.0%
distribute-lft-in23.0%
associate-*r*23.0%
unpow223.0%
*-commutative23.0%
sub-neg23.0%
unpow223.0%
Simplified23.0%
Final simplification44.9%
(FPCore (x y z t) :precision binary64 (if (<= t -1.55e+48) (- t) (if (<= t 1.4e+61) (* z (- (* -0.5 (* y y)) y)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.55e+48) {
tmp = -t;
} else if (t <= 1.4e+61) {
tmp = z * ((-0.5 * (y * y)) - 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 <= (-1.55d+48)) then
tmp = -t
else if (t <= 1.4d+61) then
tmp = z * (((-0.5d0) * (y * y)) - 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 <= -1.55e+48) {
tmp = -t;
} else if (t <= 1.4e+61) {
tmp = z * ((-0.5 * (y * y)) - y);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.55e+48: tmp = -t elif t <= 1.4e+61: tmp = z * ((-0.5 * (y * y)) - y) else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.55e+48) tmp = Float64(-t); elseif (t <= 1.4e+61) tmp = Float64(z * Float64(Float64(-0.5 * Float64(y * y)) - y)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.55e+48) tmp = -t; elseif (t <= 1.4e+61) tmp = z * ((-0.5 * (y * y)) - y); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.55e+48], (-t), If[LessEqual[t, 1.4e+61], N[(z * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.55 \cdot 10^{+48}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 1.4 \cdot 10^{+61}:\\
\;\;\;\;z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -1.55000000000000003e48 or 1.4000000000000001e61 < t Initial program 97.3%
Taylor expanded in t around inf 77.8%
neg-mul-177.8%
Simplified77.8%
if -1.55000000000000003e48 < t < 1.4000000000000001e61Initial program 80.0%
Taylor expanded in y around 0 99.1%
mul-1-neg99.1%
unsub-neg99.1%
unpow299.1%
associate-*r*99.1%
Simplified99.1%
Taylor expanded in z around inf 22.4%
*-commutative22.4%
unpow222.4%
Simplified22.4%
Final simplification44.5%
(FPCore (x y z t) :precision binary64 (- t))
double code(double x, double y, double z, double t) {
return -t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -t
end function
public static double code(double x, double y, double z, double t) {
return -t;
}
def code(x, y, z, t): return -t
function code(x, y, z, t) return Float64(-t) end
function tmp = code(x, y, z, t) tmp = -t; end
code[x_, y_, z_, t_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 86.9%
Taylor expanded in t around inf 33.8%
neg-mul-133.8%
Simplified33.8%
Final simplification33.8%
herbie shell --seed 2023196
(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))