
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
(FPCore (x y z t) :precision binary64 (fma (+ z -1.0) (log1p (- y)) (- (* (+ x -1.0) (log y)) t)))
double code(double x, double y, double z, double t) {
return fma((z + -1.0), log1p(-y), (((x + -1.0) * log(y)) - t));
}
function code(x, y, z, t) return fma(Float64(z + -1.0), log1p(Float64(-y)), Float64(Float64(Float64(x + -1.0) * log(y)) - t)) end
code[x_, y_, z_, t_] := N[(N[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y - t\right)
\end{array}
Initial program 89.7%
+-commutative89.7%
associate--l+89.7%
fma-def89.7%
sub-neg89.7%
log1p-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(-
(+
(* (+ x -1.0) (log y))
(-
(* z (+ (* -0.5 (* y y)) (* (pow y 3.0) -0.3333333333333333)))
(* y (+ z -1.0))))
t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + ((z * ((-0.5 * (y * y)) + (pow(y, 3.0) * -0.3333333333333333))) - (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 = (((x + (-1.0d0)) * log(y)) + ((z * (((-0.5d0) * (y * y)) + ((y ** 3.0d0) * (-0.3333333333333333d0)))) - (y * (z + (-1.0d0))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) + ((z * ((-0.5 * (y * y)) + (Math.pow(y, 3.0) * -0.3333333333333333))) - (y * (z + -1.0)))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + ((z * ((-0.5 * (y * y)) + (math.pow(y, 3.0) * -0.3333333333333333))) - (y * (z + -1.0)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(Float64(z * Float64(Float64(-0.5 * Float64(y * y)) + Float64((y ^ 3.0) * -0.3333333333333333))) - Float64(y * Float64(z + -1.0)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + ((z * ((-0.5 * (y * y)) + ((y ^ 3.0) * -0.3333333333333333))) - (y * (z + -1.0)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(N[Power[y, 3.0], $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + \left(z \cdot \left(-0.5 \cdot \left(y \cdot y\right) + {y}^{3} \cdot -0.3333333333333333\right) - y \cdot \left(z + -1\right)\right)\right) - t
\end{array}
Initial program 89.7%
Taylor expanded in y around 0 99.3%
associate-+r+99.3%
mul-1-neg99.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in z around inf 99.1%
*-commutative99.1%
fma-def99.1%
unpow299.1%
*-commutative99.1%
Simplified99.1%
fma-udef99.1%
Applied egg-rr99.1%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ x -1.0) (log y)) (- (* (* y y) (+ 0.5 (* z -0.5))) (* y (+ z -1.0)))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + (((y * y) * (0.5 + (z * -0.5))) - (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 = (((x + (-1.0d0)) * log(y)) + (((y * y) * (0.5d0 + (z * (-0.5d0)))) - (y * (z + (-1.0d0))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) + (((y * y) * (0.5 + (z * -0.5))) - (y * (z + -1.0)))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + (((y * y) * (0.5 + (z * -0.5))) - (y * (z + -1.0)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(Float64(Float64(y * y) * Float64(0.5 + Float64(z * -0.5))) - Float64(y * Float64(z + -1.0)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + (((y * y) * (0.5 + (z * -0.5))) - (y * (z + -1.0)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y * y), $MachinePrecision] * N[(0.5 + N[(z * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + \left(\left(y \cdot y\right) \cdot \left(0.5 + z \cdot -0.5\right) - y \cdot \left(z + -1\right)\right)\right) - t
\end{array}
Initial program 89.7%
Taylor expanded in y around 0 99.1%
mul-1-neg99.1%
unsub-neg99.1%
associate-*r*99.1%
*-commutative99.1%
unpow299.1%
sub-neg99.1%
metadata-eval99.1%
+-commutative99.1%
distribute-lft-in99.1%
metadata-eval99.1%
*-commutative99.1%
sub-neg99.1%
metadata-eval99.1%
+-commutative99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ x -1.0) -20000000000000.0) (not (<= (+ x -1.0) -1.0))) (- (- (* x (log y)) (* y (+ z -1.0))) t) (- (- (- y (* z y)) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x + -1.0) <= -20000000000000.0) || !((x + -1.0) <= -1.0)) {
tmp = ((x * log(y)) - (y * (z + -1.0))) - 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 + (-1.0d0)) <= (-20000000000000.0d0)) .or. (.not. ((x + (-1.0d0)) <= (-1.0d0)))) then
tmp = ((x * log(y)) - (y * (z + (-1.0d0)))) - 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 + -1.0) <= -20000000000000.0) || !((x + -1.0) <= -1.0)) {
tmp = ((x * Math.log(y)) - (y * (z + -1.0))) - t;
} else {
tmp = ((y - (z * y)) - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x + -1.0) <= -20000000000000.0) or not ((x + -1.0) <= -1.0): tmp = ((x * math.log(y)) - (y * (z + -1.0))) - t else: tmp = ((y - (z * y)) - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x + -1.0) <= -20000000000000.0) || !(Float64(x + -1.0) <= -1.0)) tmp = Float64(Float64(Float64(x * log(y)) - Float64(y * Float64(z + -1.0))) - 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 + -1.0) <= -20000000000000.0) || ~(((x + -1.0) <= -1.0))) tmp = ((x * log(y)) - (y * (z + -1.0))) - t; else tmp = ((y - (z * y)) - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x + -1.0), $MachinePrecision], -20000000000000.0], N[Not[LessEqual[N[(x + -1.0), $MachinePrecision], -1.0]], $MachinePrecision]], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * N[(z + -1.0), $MachinePrecision]), $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 + -1 \leq -20000000000000 \lor \neg \left(x + -1 \leq -1\right):\\
\;\;\;\;\left(x \cdot \log y - y \cdot \left(z + -1\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y - z \cdot y\right) - \log y\right) - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -2e13 or -1 < (-.f64 x 1) Initial program 92.5%
Taylor expanded in y around 0 98.3%
+-commutative98.3%
sub-neg98.3%
metadata-eval98.3%
mul-1-neg98.3%
unsub-neg98.3%
*-commutative98.3%
+-commutative98.3%
*-commutative98.3%
sub-neg98.3%
metadata-eval98.3%
+-commutative98.3%
Simplified98.3%
Taylor expanded in x around inf 98.2%
if -2e13 < (-.f64 x 1) < -1Initial program 87.0%
add-cbrt-cube86.7%
pow386.8%
sub-neg86.8%
metadata-eval86.8%
Applied egg-rr86.8%
Taylor expanded in y around 0 98.3%
mul-1-neg98.3%
Simplified98.3%
Taylor expanded in x around 0 98.3%
mul-1-neg98.3%
sub-neg98.3%
metadata-eval98.3%
*-commutative98.3%
distribute-lft-neg-out98.3%
mul-1-neg98.3%
unsub-neg98.3%
+-commutative98.3%
distribute-rgt-in98.3%
neg-mul-198.3%
remove-double-neg98.3%
distribute-rgt-neg-in98.3%
unsub-neg98.3%
*-commutative98.3%
Simplified98.3%
Final simplification98.3%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ x -1.0) (log y)) (- (* y (* y 0.5)) (* y (+ z -1.0)))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + ((y * (y * 0.5)) - (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 = (((x + (-1.0d0)) * log(y)) + ((y * (y * 0.5d0)) - (y * (z + (-1.0d0))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) + ((y * (y * 0.5)) - (y * (z + -1.0)))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + ((y * (y * 0.5)) - (y * (z + -1.0)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(Float64(y * Float64(y * 0.5)) - Float64(y * Float64(z + -1.0)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + ((y * (y * 0.5)) - (y * (z + -1.0)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(y * N[(y * 0.5), $MachinePrecision]), $MachinePrecision] - N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + \left(y \cdot \left(y \cdot 0.5\right) - y \cdot \left(z + -1\right)\right)\right) - t
\end{array}
Initial program 89.7%
Taylor expanded in y around 0 99.1%
mul-1-neg99.1%
unsub-neg99.1%
associate-*r*99.1%
*-commutative99.1%
unpow299.1%
sub-neg99.1%
metadata-eval99.1%
+-commutative99.1%
distribute-lft-in99.1%
metadata-eval99.1%
*-commutative99.1%
sub-neg99.1%
metadata-eval99.1%
+-commutative99.1%
Simplified99.1%
Taylor expanded in z around 0 98.5%
unpow298.5%
*-commutative98.5%
associate-*l*98.5%
Simplified98.5%
Final simplification98.5%
(FPCore (x y z t)
:precision binary64
(if (<= (+ x -1.0) -2e+31)
(- (* x (log y)) t)
(if (<= (+ x -1.0) -1.0)
(- (- (- y (* z y)) (log y)) t)
(- (* (+ x -1.0) (log y)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + -1.0) <= -2e+31) {
tmp = (x * log(y)) - t;
} else if ((x + -1.0) <= -1.0) {
tmp = ((y - (z * y)) - log(y)) - t;
} else {
tmp = ((x + -1.0) * 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)) <= (-2d+31)) then
tmp = (x * log(y)) - t
else if ((x + (-1.0d0)) <= (-1.0d0)) then
tmp = ((y - (z * y)) - log(y)) - t
else
tmp = ((x + (-1.0d0)) * 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) <= -2e+31) {
tmp = (x * Math.log(y)) - t;
} else if ((x + -1.0) <= -1.0) {
tmp = ((y - (z * y)) - Math.log(y)) - t;
} else {
tmp = ((x + -1.0) * Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + -1.0) <= -2e+31: tmp = (x * math.log(y)) - t elif (x + -1.0) <= -1.0: tmp = ((y - (z * y)) - math.log(y)) - t else: tmp = ((x + -1.0) * math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + -1.0) <= -2e+31) tmp = Float64(Float64(x * log(y)) - t); elseif (Float64(x + -1.0) <= -1.0) tmp = Float64(Float64(Float64(y - Float64(z * y)) - log(y)) - t); else tmp = Float64(Float64(Float64(x + -1.0) * log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + -1.0) <= -2e+31) tmp = (x * log(y)) - t; elseif ((x + -1.0) <= -1.0) tmp = ((y - (z * y)) - log(y)) - t; else tmp = ((x + -1.0) * log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + -1.0), $MachinePrecision], -2e+31], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(x + -1.0), $MachinePrecision], -1.0], N[(N[(N[(y - N[(z * y), $MachinePrecision]), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + -1 \leq -2 \cdot 10^{+31}:\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{elif}\;x + -1 \leq -1:\\
\;\;\;\;\left(\left(y - z \cdot y\right) - \log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(x + -1\right) \cdot \log y - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -1.9999999999999999e31Initial program 93.6%
Taylor expanded in y around 0 98.9%
mul-1-neg98.9%
unsub-neg98.9%
associate-*r*98.9%
*-commutative98.9%
unpow298.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
distribute-lft-in98.9%
metadata-eval98.9%
*-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
*-commutative98.9%
flip--51.7%
associate-*r/48.8%
metadata-eval48.8%
fma-neg48.8%
metadata-eval48.8%
+-commutative48.8%
Applied egg-rr48.8%
associate-/l*51.6%
Simplified51.6%
Taylor expanded in x around inf 98.8%
Taylor expanded in y around 0 90.9%
if -1.9999999999999999e31 < (-.f64 x 1) < -1Initial program 85.7%
add-cbrt-cube85.4%
pow385.5%
sub-neg85.5%
metadata-eval85.5%
Applied egg-rr85.5%
Taylor expanded in y around 0 98.3%
mul-1-neg98.3%
Simplified98.3%
Taylor expanded in x around 0 97.8%
mul-1-neg97.8%
sub-neg97.8%
metadata-eval97.8%
*-commutative97.8%
distribute-lft-neg-out97.8%
mul-1-neg97.8%
unsub-neg97.8%
+-commutative97.8%
distribute-rgt-in97.8%
neg-mul-197.8%
remove-double-neg97.8%
distribute-rgt-neg-in97.8%
unsub-neg97.8%
*-commutative97.8%
Simplified97.8%
if -1 < (-.f64 x 1) Initial program 94.5%
Taylor expanded in y around 0 93.0%
Final simplification95.0%
(FPCore (x y z t) :precision binary64 (- (- (* (+ x -1.0) (log y)) (* y (+ z -1.0))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) - (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 = (((x + (-1.0d0)) * log(y)) - (y * (z + (-1.0d0)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) - (y * (z + -1.0))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) - (y * (z + -1.0))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) - Float64(y * Float64(z + -1.0))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) - (y * (z + -1.0))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y - y \cdot \left(z + -1\right)\right) - t
\end{array}
Initial program 89.7%
Taylor expanded in y around 0 98.4%
+-commutative98.4%
sub-neg98.4%
metadata-eval98.4%
mul-1-neg98.4%
unsub-neg98.4%
*-commutative98.4%
+-commutative98.4%
*-commutative98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.5e+24) (not (<= x 4.2e-13))) (- (* x (log y)) t) (- (* z (log1p (- y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.5e+24) || !(x <= 4.2e-13)) {
tmp = (x * log(y)) - t;
} else {
tmp = (z * log1p(-y)) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.5e+24) || !(x <= 4.2e-13)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = (z * Math.log1p(-y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.5e+24) or not (x <= 4.2e-13): tmp = (x * math.log(y)) - t else: tmp = (z * math.log1p(-y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.5e+24) || !(x <= 4.2e-13)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(z * log1p(Float64(-y))) - t); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.5e+24], N[Not[LessEqual[x, 4.2e-13]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{+24} \lor \neg \left(x \leq 4.2 \cdot 10^{-13}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\end{array}
\end{array}
if x < -4.50000000000000019e24 or 4.19999999999999977e-13 < x Initial program 94.0%
Taylor expanded in y around 0 98.9%
mul-1-neg98.9%
unsub-neg98.9%
associate-*r*98.9%
*-commutative98.9%
unpow298.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
distribute-lft-in98.9%
metadata-eval98.9%
*-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
*-commutative98.9%
flip--55.1%
associate-*r/53.5%
metadata-eval53.5%
fma-neg53.5%
metadata-eval53.5%
+-commutative53.5%
Applied egg-rr53.5%
associate-/l*55.0%
Simplified55.0%
Taylor expanded in x around inf 98.8%
Taylor expanded in y around 0 91.8%
if -4.50000000000000019e24 < x < 4.19999999999999977e-13Initial program 85.7%
Taylor expanded in z around inf 49.8%
sub-neg49.8%
mul-1-neg49.8%
log1p-def62.9%
mul-1-neg62.9%
Simplified62.9%
Final simplification76.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.7e+24) (not (<= x 4.2e-13))) (- (* x (log y)) t) (- (* z (- (* -0.5 (* y y)) y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.7e+24) || !(x <= 4.2e-13)) {
tmp = (x * log(y)) - t;
} else {
tmp = (z * ((-0.5 * (y * y)) - 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 <= (-2.7d+24)) .or. (.not. (x <= 4.2d-13))) then
tmp = (x * log(y)) - t
else
tmp = (z * (((-0.5d0) * (y * y)) - y)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.7e+24) || !(x <= 4.2e-13)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = (z * ((-0.5 * (y * y)) - y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.7e+24) or not (x <= 4.2e-13): tmp = (x * math.log(y)) - t else: tmp = (z * ((-0.5 * (y * y)) - y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.7e+24) || !(x <= 4.2e-13)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(z * Float64(Float64(-0.5 * Float64(y * y)) - y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.7e+24) || ~((x <= 4.2e-13))) tmp = (x * log(y)) - t; else tmp = (z * ((-0.5 * (y * y)) - y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.7e+24], N[Not[LessEqual[x, 4.2e-13]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{+24} \lor \neg \left(x \leq 4.2 \cdot 10^{-13}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t\\
\end{array}
\end{array}
if x < -2.7e24 or 4.19999999999999977e-13 < x Initial program 94.0%
Taylor expanded in y around 0 98.9%
mul-1-neg98.9%
unsub-neg98.9%
associate-*r*98.9%
*-commutative98.9%
unpow298.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
distribute-lft-in98.9%
metadata-eval98.9%
*-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
*-commutative98.9%
flip--55.1%
associate-*r/53.5%
metadata-eval53.5%
fma-neg53.5%
metadata-eval53.5%
+-commutative53.5%
Applied egg-rr53.5%
associate-/l*55.0%
Simplified55.0%
Taylor expanded in x around inf 98.8%
Taylor expanded in y around 0 91.8%
if -2.7e24 < x < 4.19999999999999977e-13Initial program 85.7%
Taylor expanded in y around 0 99.2%
mul-1-neg99.2%
unsub-neg99.2%
associate-*r*99.2%
*-commutative99.2%
unpow299.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
distribute-lft-in99.2%
metadata-eval99.2%
*-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
*-commutative99.2%
flip--99.2%
associate-*r/99.2%
metadata-eval99.2%
fma-neg99.2%
metadata-eval99.2%
+-commutative99.2%
Applied egg-rr99.2%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in z around inf 62.8%
*-commutative62.8%
unpow262.8%
Simplified62.8%
Final simplification76.7%
(FPCore (x y z t) :precision binary64 (if (<= z -2e+275) (- (* z (- (* -0.5 (* y y)) y)) t) (- (* (+ x -1.0) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2e+275) {
tmp = (z * ((-0.5 * (y * y)) - y)) - t;
} else {
tmp = ((x + -1.0) * 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 (z <= (-2d+275)) then
tmp = (z * (((-0.5d0) * (y * y)) - y)) - t
else
tmp = ((x + (-1.0d0)) * log(y)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2e+275) {
tmp = (z * ((-0.5 * (y * y)) - y)) - t;
} else {
tmp = ((x + -1.0) * Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2e+275: tmp = (z * ((-0.5 * (y * y)) - y)) - t else: tmp = ((x + -1.0) * math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2e+275) tmp = Float64(Float64(z * Float64(Float64(-0.5 * Float64(y * y)) - y)) - t); else tmp = Float64(Float64(Float64(x + -1.0) * log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2e+275) tmp = (z * ((-0.5 * (y * y)) - y)) - t; else tmp = ((x + -1.0) * log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2e+275], N[(N[(z * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+275}:\\
\;\;\;\;z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(x + -1\right) \cdot \log y - t\\
\end{array}
\end{array}
if z < -1.99999999999999992e275Initial program 22.9%
Taylor expanded in y around 0 99.6%
mul-1-neg99.6%
unsub-neg99.6%
associate-*r*99.6%
*-commutative99.6%
unpow299.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
distribute-lft-in99.6%
metadata-eval99.6%
*-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
Simplified99.6%
*-commutative99.6%
flip--99.6%
associate-*r/99.6%
metadata-eval99.6%
fma-neg99.6%
metadata-eval99.6%
+-commutative99.6%
Applied egg-rr99.6%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in z around inf 99.8%
*-commutative99.8%
unpow299.8%
Simplified99.8%
if -1.99999999999999992e275 < z Initial program 91.8%
Taylor expanded in y around 0 89.8%
Final simplification90.1%
(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 89.7%
Taylor expanded in y around 0 99.1%
mul-1-neg99.1%
unsub-neg99.1%
associate-*r*99.1%
*-commutative99.1%
unpow299.1%
sub-neg99.1%
metadata-eval99.1%
+-commutative99.1%
distribute-lft-in99.1%
metadata-eval99.1%
*-commutative99.1%
sub-neg99.1%
metadata-eval99.1%
+-commutative99.1%
Simplified99.1%
*-commutative99.1%
flip--78.0%
associate-*r/77.2%
metadata-eval77.2%
fma-neg77.2%
metadata-eval77.2%
+-commutative77.2%
Applied egg-rr77.2%
associate-/l*78.0%
Simplified78.0%
Taylor expanded in z around inf 47.0%
*-commutative47.0%
unpow247.0%
Simplified47.0%
Final simplification47.0%
(FPCore (x y z t) :precision binary64 (- (* y (- 1.0 z)) t))
double code(double x, double y, double z, double t) {
return (y * (1.0 - z)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (y * (1.0d0 - z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * (1.0 - z)) - t;
}
def code(x, y, z, t): return (y * (1.0 - z)) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(1.0 - z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * (1.0 - z)) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(1 - z\right) - t
\end{array}
Initial program 89.7%
Taylor expanded in y around 0 98.4%
+-commutative98.4%
sub-neg98.4%
metadata-eval98.4%
mul-1-neg98.4%
unsub-neg98.4%
*-commutative98.4%
+-commutative98.4%
*-commutative98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
Simplified98.4%
Taylor expanded in y around inf 46.7%
Final simplification46.7%
(FPCore (x y z t) :precision binary64 (- (* z (- y)) t))
double code(double x, double y, double z, double t) {
return (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 = (z * -y) - t
end function
public static double code(double x, double y, double z, double t) {
return (z * -y) - t;
}
def code(x, y, z, t): return (z * -y) - t
function code(x, y, z, t) return Float64(Float64(z * Float64(-y)) - t) end
function tmp = code(x, y, z, t) tmp = (z * -y) - t; end
code[x_, y_, z_, t_] := N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(-y\right) - t
\end{array}
Initial program 89.7%
Taylor expanded in y around 0 98.4%
+-commutative98.4%
sub-neg98.4%
metadata-eval98.4%
mul-1-neg98.4%
unsub-neg98.4%
*-commutative98.4%
+-commutative98.4%
*-commutative98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
Simplified98.4%
Taylor expanded in z around inf 46.5%
associate-*r*46.5%
neg-mul-146.5%
Simplified46.5%
Final simplification46.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 89.7%
+-commutative89.7%
associate--l+89.7%
fma-def89.7%
sub-neg89.7%
log1p-def99.8%
Simplified99.8%
Taylor expanded in t around inf 36.3%
neg-mul-136.3%
Simplified36.3%
Final simplification36.3%
herbie shell --seed 2023257
(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))