
(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 (+ x -1.0) (log y) (* z (log1p (- y)))) t))
double code(double x, double y, double z, double t) {
return fma((x + -1.0), log(y), (z * log1p(-y))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(x + -1.0), log(y), Float64(z * log1p(Float64(-y)))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x + -1, \log y, z \cdot \mathsf{log1p}\left(-y\right)\right) - t
\end{array}
Initial program 90.3%
fma-define90.3%
sub-neg90.3%
metadata-eval90.3%
sub-neg90.3%
metadata-eval90.3%
sub-neg90.3%
log1p-define99.8%
Simplified99.8%
Taylor expanded in z around inf 99.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ x -1.0) -2e+33) (not (<= (+ x -1.0) -0.999))) (- (- (* x (log y)) (* y z)) t) (- (- (- (log y)) (* y z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x + -1.0) <= -2e+33) || !((x + -1.0) <= -0.999)) {
tmp = ((x * log(y)) - (y * z)) - t;
} else {
tmp = (-log(y) - (y * z)) - 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+33)) .or. (.not. ((x + (-1.0d0)) <= (-0.999d0)))) then
tmp = ((x * log(y)) - (y * z)) - t
else
tmp = (-log(y) - (y * z)) - 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+33) || !((x + -1.0) <= -0.999)) {
tmp = ((x * Math.log(y)) - (y * z)) - t;
} else {
tmp = (-Math.log(y) - (y * z)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x + -1.0) <= -2e+33) or not ((x + -1.0) <= -0.999): tmp = ((x * math.log(y)) - (y * z)) - t else: tmp = (-math.log(y) - (y * z)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x + -1.0) <= -2e+33) || !(Float64(x + -1.0) <= -0.999)) tmp = Float64(Float64(Float64(x * log(y)) - Float64(y * z)) - t); else tmp = Float64(Float64(Float64(-log(y)) - Float64(y * z)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x + -1.0) <= -2e+33) || ~(((x + -1.0) <= -0.999))) tmp = ((x * log(y)) - (y * z)) - t; else tmp = (-log(y) - (y * z)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x + -1.0), $MachinePrecision], -2e+33], N[Not[LessEqual[N[(x + -1.0), $MachinePrecision], -0.999]], $MachinePrecision]], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[((-N[Log[y], $MachinePrecision]) - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + -1 \leq -2 \cdot 10^{+33} \lor \neg \left(x + -1 \leq -0.999\right):\\
\;\;\;\;\left(x \cdot \log y - y \cdot z\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-\log y\right) - y \cdot z\right) - t\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -1.9999999999999999e33 or -0.998999999999999999 < (-.f64 x #s(literal 1 binary64)) Initial program 94.4%
fma-define94.4%
sub-neg94.4%
metadata-eval94.4%
sub-neg94.4%
metadata-eval94.4%
sub-neg94.4%
log1p-define99.7%
Simplified99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in y around 0 99.7%
+-commutative99.7%
mul-1-neg99.7%
unsub-neg99.7%
sub-neg99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 99.1%
if -1.9999999999999999e33 < (-.f64 x #s(literal 1 binary64)) < -0.998999999999999999Initial program 86.0%
fma-define86.0%
sub-neg86.0%
metadata-eval86.0%
sub-neg86.0%
metadata-eval86.0%
sub-neg86.0%
log1p-define100.0%
Simplified100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in y around 0 99.9%
+-commutative99.9%
mul-1-neg99.9%
unsub-neg99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in x around 0 99.3%
neg-mul-199.3%
Simplified99.3%
Final simplification99.2%
(FPCore (x y z t)
:precision binary64
(if (<= (+ x -1.0) -2e+33)
(- (* x (log y)) t)
(if (<= (+ x -1.0) -1.0)
(- (- (- (log y)) (* y z)) t)
(- (* (log y) (+ x -1.0)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + -1.0) <= -2e+33) {
tmp = (x * log(y)) - t;
} else if ((x + -1.0) <= -1.0) {
tmp = (-log(y) - (y * z)) - t;
} else {
tmp = (log(y) * (x + -1.0)) - 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+33)) then
tmp = (x * log(y)) - t
else if ((x + (-1.0d0)) <= (-1.0d0)) then
tmp = (-log(y) - (y * z)) - t
else
tmp = (log(y) * (x + (-1.0d0))) - 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+33) {
tmp = (x * Math.log(y)) - t;
} else if ((x + -1.0) <= -1.0) {
tmp = (-Math.log(y) - (y * z)) - t;
} else {
tmp = (Math.log(y) * (x + -1.0)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + -1.0) <= -2e+33: tmp = (x * math.log(y)) - t elif (x + -1.0) <= -1.0: tmp = (-math.log(y) - (y * z)) - t else: tmp = (math.log(y) * (x + -1.0)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + -1.0) <= -2e+33) tmp = Float64(Float64(x * log(y)) - t); elseif (Float64(x + -1.0) <= -1.0) tmp = Float64(Float64(Float64(-log(y)) - Float64(y * z)) - t); else tmp = Float64(Float64(log(y) * Float64(x + -1.0)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + -1.0) <= -2e+33) tmp = (x * log(y)) - t; elseif ((x + -1.0) <= -1.0) tmp = (-log(y) - (y * z)) - t; else tmp = (log(y) * (x + -1.0)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + -1.0), $MachinePrecision], -2e+33], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(x + -1.0), $MachinePrecision], -1.0], N[(N[((-N[Log[y], $MachinePrecision]) - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + -1 \leq -2 \cdot 10^{+33}:\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{elif}\;x + -1 \leq -1:\\
\;\;\;\;\left(\left(-\log y\right) - y \cdot z\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(x + -1\right) - t\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -1.9999999999999999e33Initial program 93.2%
fma-define93.2%
sub-neg93.2%
metadata-eval93.2%
sub-neg93.2%
metadata-eval93.2%
sub-neg93.2%
log1p-define99.7%
Simplified99.7%
Taylor expanded in y around 0 93.2%
Taylor expanded in x around inf 93.2%
if -1.9999999999999999e33 < (-.f64 x #s(literal 1 binary64)) < -1Initial program 85.7%
fma-define85.7%
sub-neg85.7%
metadata-eval85.7%
sub-neg85.7%
metadata-eval85.7%
sub-neg85.7%
log1p-define100.0%
Simplified100.0%
Taylor expanded in z around inf 100.0%
Taylor expanded in y around 0 99.9%
+-commutative99.9%
mul-1-neg99.9%
unsub-neg99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
neg-mul-199.9%
Simplified99.9%
if -1 < (-.f64 x #s(literal 1 binary64)) Initial program 95.6%
fma-define95.6%
sub-neg95.6%
metadata-eval95.6%
sub-neg95.6%
metadata-eval95.6%
sub-neg95.6%
log1p-define99.7%
Simplified99.7%
Taylor expanded in y around 0 95.6%
Final simplification97.1%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ x -1.0)) (* y (+ (- 1.0 z) (* -0.5 (* y (+ -1.0 z)))))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) + (y * ((1.0 - z) + (-0.5 * (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 = ((log(y) * (x + (-1.0d0))) + (y * ((1.0d0 - z) + ((-0.5d0) * (y * ((-1.0d0) + z)))))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) + (y * ((1.0 - z) + (-0.5 * (y * (-1.0 + z)))))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) + (y * ((1.0 - z) + (-0.5 * (y * (-1.0 + z)))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(y * Float64(Float64(1.0 - z) + Float64(-0.5 * Float64(y * Float64(-1.0 + z)))))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) + (y * ((1.0 - z) + (-0.5 * (y * (-1.0 + z)))))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(y * N[(N[(1.0 - z), $MachinePrecision] + N[(-0.5 * N[(y * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) + y \cdot \left(\left(1 - z\right) + -0.5 \cdot \left(y \cdot \left(-1 + z\right)\right)\right)\right) - t
\end{array}
Initial program 90.3%
Taylor expanded in y around 0 99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x (log y)) t)))
(if (<= x -9.2e+29)
t_1
(if (<= x -2.3e-66)
(- (* z (- y)) t)
(if (<= x 0.00166) (- (- (log y)) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x * log(y)) - t;
double tmp;
if (x <= -9.2e+29) {
tmp = t_1;
} else if (x <= -2.3e-66) {
tmp = (z * -y) - t;
} else if (x <= 0.00166) {
tmp = -log(y) - t;
} else {
tmp = t_1;
}
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)) - t
if (x <= (-9.2d+29)) then
tmp = t_1
else if (x <= (-2.3d-66)) then
tmp = (z * -y) - t
else if (x <= 0.00166d0) then
tmp = -log(y) - t
else
tmp = t_1
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)) - t;
double tmp;
if (x <= -9.2e+29) {
tmp = t_1;
} else if (x <= -2.3e-66) {
tmp = (z * -y) - t;
} else if (x <= 0.00166) {
tmp = -Math.log(y) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * math.log(y)) - t tmp = 0 if x <= -9.2e+29: tmp = t_1 elif x <= -2.3e-66: tmp = (z * -y) - t elif x <= 0.00166: tmp = -math.log(y) - t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * log(y)) - t) tmp = 0.0 if (x <= -9.2e+29) tmp = t_1; elseif (x <= -2.3e-66) tmp = Float64(Float64(z * Float64(-y)) - t); elseif (x <= 0.00166) tmp = Float64(Float64(-log(y)) - t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * log(y)) - t; tmp = 0.0; if (x <= -9.2e+29) tmp = t_1; elseif (x <= -2.3e-66) tmp = (z * -y) - t; elseif (x <= 0.00166) tmp = -log(y) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[x, -9.2e+29], t$95$1, If[LessEqual[x, -2.3e-66], N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[x, 0.00166], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y - t\\
\mathbf{if}\;x \leq -9.2 \cdot 10^{+29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.3 \cdot 10^{-66}:\\
\;\;\;\;z \cdot \left(-y\right) - t\\
\mathbf{elif}\;x \leq 0.00166:\\
\;\;\;\;\left(-\log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -9.2000000000000004e29 or 0.00166 < x Initial program 94.4%
fma-define94.4%
sub-neg94.4%
metadata-eval94.4%
sub-neg94.4%
metadata-eval94.4%
sub-neg94.4%
log1p-define99.7%
Simplified99.7%
Taylor expanded in y around 0 94.4%
Taylor expanded in x around inf 93.8%
if -9.2000000000000004e29 < x < -2.29999999999999992e-66Initial program 69.5%
flip--69.5%
metadata-eval69.5%
metadata-eval69.5%
associate-*l/69.5%
metadata-eval69.5%
fma-neg69.5%
metadata-eval69.5%
+-commutative69.5%
Applied egg-rr69.5%
Taylor expanded in y around 0 99.9%
mul-1-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 99.9%
associate-*r*99.9%
mul-1-neg99.9%
Simplified99.9%
if -2.29999999999999992e-66 < x < 0.00166Initial program 88.9%
fma-define88.9%
sub-neg88.9%
metadata-eval88.9%
sub-neg88.9%
metadata-eval88.9%
sub-neg88.9%
log1p-define100.0%
Simplified100.0%
Taylor expanded in y around 0 88.6%
Taylor expanded in x around 0 87.9%
mul-1-neg87.9%
Simplified87.9%
Final simplification91.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= x -4.55e+108)
t_1
(if (<= x -2.75e-66)
(- (* y (- 1.0 z)) t)
(if (<= x 140.0) (- (- (log y)) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (x <= -4.55e+108) {
tmp = t_1;
} else if (x <= -2.75e-66) {
tmp = (y * (1.0 - z)) - t;
} else if (x <= 140.0) {
tmp = -log(y) - t;
} else {
tmp = t_1;
}
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 (x <= (-4.55d+108)) then
tmp = t_1
else if (x <= (-2.75d-66)) then
tmp = (y * (1.0d0 - z)) - t
else if (x <= 140.0d0) then
tmp = -log(y) - t
else
tmp = t_1
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 (x <= -4.55e+108) {
tmp = t_1;
} else if (x <= -2.75e-66) {
tmp = (y * (1.0 - z)) - t;
} else if (x <= 140.0) {
tmp = -Math.log(y) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if x <= -4.55e+108: tmp = t_1 elif x <= -2.75e-66: tmp = (y * (1.0 - z)) - t elif x <= 140.0: tmp = -math.log(y) - t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if (x <= -4.55e+108) tmp = t_1; elseif (x <= -2.75e-66) tmp = Float64(Float64(y * Float64(1.0 - z)) - t); elseif (x <= 140.0) tmp = Float64(Float64(-log(y)) - t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if (x <= -4.55e+108) tmp = t_1; elseif (x <= -2.75e-66) tmp = (y * (1.0 - z)) - t; elseif (x <= 140.0) tmp = -log(y) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.55e+108], t$95$1, If[LessEqual[x, -2.75e-66], N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[x, 140.0], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -4.55 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.75 \cdot 10^{-66}:\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\
\mathbf{elif}\;x \leq 140:\\
\;\;\;\;\left(-\log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4.5499999999999999e108 or 140 < x Initial program 95.5%
fma-define95.5%
sub-neg95.5%
metadata-eval95.5%
sub-neg95.5%
metadata-eval95.5%
sub-neg95.5%
log1p-define99.7%
Simplified99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in x around inf 73.4%
*-commutative73.4%
Simplified73.4%
if -4.5499999999999999e108 < x < -2.75000000000000026e-66Initial program 75.4%
flip--75.4%
metadata-eval75.4%
metadata-eval75.4%
associate-*l/75.4%
metadata-eval75.4%
fma-neg75.4%
metadata-eval75.4%
+-commutative75.4%
Applied egg-rr75.4%
Taylor expanded in y around 0 99.9%
mul-1-neg99.9%
Simplified99.9%
Taylor expanded in y around inf 84.9%
mul-1-neg84.9%
sub-neg84.9%
metadata-eval84.9%
+-commutative84.9%
distribute-rgt-neg-in84.9%
distribute-neg-in84.9%
metadata-eval84.9%
unsub-neg84.9%
Simplified84.9%
if -2.75000000000000026e-66 < x < 140Initial program 89.0%
fma-define89.0%
sub-neg89.0%
metadata-eval89.0%
sub-neg89.0%
metadata-eval89.0%
sub-neg89.0%
log1p-define100.0%
Simplified100.0%
Taylor expanded in y around 0 88.7%
Taylor expanded in x around 0 88.0%
mul-1-neg88.0%
Simplified88.0%
Final simplification80.9%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ x -1.0)) (* (+ -1.0 z) (* y (+ -1.0 (* y -0.5))))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) + ((-1.0 + z) * (y * (-1.0 + (y * -0.5))))) - 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))) + (((-1.0d0) + z) * (y * ((-1.0d0) + (y * (-0.5d0)))))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) + ((-1.0 + z) * (y * (-1.0 + (y * -0.5))))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) + ((-1.0 + z) * (y * (-1.0 + (y * -0.5))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(Float64(-1.0 + z) * Float64(y * Float64(-1.0 + Float64(y * -0.5))))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) + ((-1.0 + z) * (y * (-1.0 + (y * -0.5))))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + z), $MachinePrecision] * N[(y * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right)\right)\right) - t
\end{array}
Initial program 90.3%
Taylor expanded in y around 0 99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1e+109) (not (<= x 1.28e+14))) (* x (log y)) (- (* y (- 1.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1e+109) || !(x <= 1.28e+14)) {
tmp = x * log(y);
} else {
tmp = (y * (1.0 - z)) - 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 <= (-1d+109)) .or. (.not. (x <= 1.28d+14))) then
tmp = x * log(y)
else
tmp = (y * (1.0d0 - z)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1e+109) || !(x <= 1.28e+14)) {
tmp = x * Math.log(y);
} else {
tmp = (y * (1.0 - z)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1e+109) or not (x <= 1.28e+14): tmp = x * math.log(y) else: tmp = (y * (1.0 - z)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1e+109) || !(x <= 1.28e+14)) tmp = Float64(x * log(y)); else tmp = Float64(Float64(y * Float64(1.0 - z)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1e+109) || ~((x <= 1.28e+14))) tmp = x * log(y); else tmp = (y * (1.0 - z)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1e+109], N[Not[LessEqual[x, 1.28e+14]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{+109} \lor \neg \left(x \leq 1.28 \cdot 10^{+14}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\
\end{array}
\end{array}
if x < -9.99999999999999982e108 or 1.28e14 < x Initial program 96.3%
fma-define96.3%
sub-neg96.3%
metadata-eval96.3%
sub-neg96.3%
metadata-eval96.3%
sub-neg96.3%
log1p-define99.7%
Simplified99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in x around inf 74.4%
*-commutative74.4%
Simplified74.4%
if -9.99999999999999982e108 < x < 1.28e14Initial program 85.4%
flip--85.4%
metadata-eval85.4%
metadata-eval85.4%
associate-*l/85.4%
metadata-eval85.4%
fma-neg85.4%
metadata-eval85.4%
+-commutative85.4%
Applied egg-rr85.4%
Taylor expanded in y around 0 99.9%
mul-1-neg99.9%
Simplified99.9%
Taylor expanded in y around inf 63.4%
mul-1-neg63.4%
sub-neg63.4%
metadata-eval63.4%
+-commutative63.4%
distribute-rgt-neg-in63.4%
distribute-neg-in63.4%
metadata-eval63.4%
unsub-neg63.4%
Simplified63.4%
Final simplification68.3%
(FPCore (x y z t) :precision binary64 (if (<= y 9e-28) (- (* (log y) (+ x -1.0)) t) (- (* z (- y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 9e-28) {
tmp = (log(y) * (x + -1.0)) - t;
} else {
tmp = (z * -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 (y <= 9d-28) then
tmp = (log(y) * (x + (-1.0d0))) - t
else
tmp = (z * -y) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= 9e-28) {
tmp = (Math.log(y) * (x + -1.0)) - t;
} else {
tmp = (z * -y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 9e-28: tmp = (math.log(y) * (x + -1.0)) - t else: tmp = (z * -y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 9e-28) tmp = Float64(Float64(log(y) * Float64(x + -1.0)) - t); else tmp = Float64(Float64(z * Float64(-y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= 9e-28) tmp = (log(y) * (x + -1.0)) - t; else tmp = (z * -y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 9e-28], N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9 \cdot 10^{-28}:\\
\;\;\;\;\log y \cdot \left(x + -1\right) - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right) - t\\
\end{array}
\end{array}
if y < 8.9999999999999996e-28Initial program 92.2%
fma-define92.2%
sub-neg92.2%
metadata-eval92.2%
sub-neg92.2%
metadata-eval92.2%
sub-neg92.2%
log1p-define99.8%
Simplified99.8%
Taylor expanded in y around 0 92.2%
if 8.9999999999999996e-28 < y Initial program 63.0%
flip--57.8%
metadata-eval57.8%
metadata-eval57.8%
associate-*l/57.8%
metadata-eval57.8%
fma-neg57.8%
metadata-eval57.8%
+-commutative57.8%
Applied egg-rr57.8%
Taylor expanded in y around 0 94.4%
mul-1-neg94.4%
Simplified94.4%
Taylor expanded in z around inf 87.2%
associate-*r*87.2%
mul-1-neg87.2%
Simplified87.2%
Final simplification91.9%
(FPCore (x y z t) :precision binary64 (- (- (* (log y) (+ x -1.0)) (* y z)) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) - (y * 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 = ((log(y) * (x + (-1.0d0))) - (y * z)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) - (y * z)) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) - (y * z)) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) - Float64(y * z)) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) - (y * z)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) - y \cdot z\right) - t
\end{array}
Initial program 90.3%
fma-define90.3%
sub-neg90.3%
metadata-eval90.3%
sub-neg90.3%
metadata-eval90.3%
sub-neg90.3%
log1p-define99.8%
Simplified99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Final simplification99.8%
(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 90.3%
flip--69.0%
metadata-eval69.0%
metadata-eval69.0%
associate-*l/68.5%
metadata-eval68.5%
fma-neg68.5%
metadata-eval68.5%
+-commutative68.5%
Applied egg-rr68.5%
Taylor expanded in y around 0 78.1%
mul-1-neg78.1%
Simplified78.1%
Taylor expanded in y around inf 46.6%
mul-1-neg46.6%
sub-neg46.6%
metadata-eval46.6%
+-commutative46.6%
distribute-rgt-neg-in46.6%
distribute-neg-in46.6%
metadata-eval46.6%
unsub-neg46.6%
Simplified46.6%
(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 90.3%
flip--69.0%
metadata-eval69.0%
metadata-eval69.0%
associate-*l/68.5%
metadata-eval68.5%
fma-neg68.5%
metadata-eval68.5%
+-commutative68.5%
Applied egg-rr68.5%
Taylor expanded in y around 0 78.1%
mul-1-neg78.1%
Simplified78.1%
Taylor expanded in z around inf 46.5%
associate-*r*46.5%
mul-1-neg46.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 90.3%
fma-define90.3%
sub-neg90.3%
metadata-eval90.3%
sub-neg90.3%
metadata-eval90.3%
sub-neg90.3%
log1p-define99.8%
Simplified99.8%
Taylor expanded in t around inf 37.0%
mul-1-neg37.0%
Simplified37.0%
(FPCore (x y z t) :precision binary64 t)
double code(double x, double y, double z, double t) {
return t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t
end function
public static double code(double x, double y, double z, double t) {
return t;
}
def code(x, y, z, t): return t
function code(x, y, z, t) return 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 90.3%
fma-define90.3%
sub-neg90.3%
metadata-eval90.3%
sub-neg90.3%
metadata-eval90.3%
sub-neg90.3%
log1p-define99.8%
Simplified99.8%
Taylor expanded in t around inf 37.0%
mul-1-neg37.0%
Simplified37.0%
neg-sub037.0%
sub-neg37.0%
add-sqr-sqrt18.6%
sqrt-unprod10.8%
sqr-neg10.8%
sqrt-unprod1.2%
add-sqr-sqrt2.2%
Applied egg-rr2.2%
+-lft-identity2.2%
Simplified2.2%
herbie shell --seed 2024150
(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))