
(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 (- (+ (* (log y) (+ x -1.0)) (/ (log1p (- y)) (/ 1.0 (+ z -1.0)))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) + (log1p(-y) / (1.0 / (z + -1.0)))) - t;
}
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) + (Math.log1p(-y) / (1.0 / (z + -1.0)))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) + (math.log1p(-y) / (1.0 / (z + -1.0)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(log1p(Float64(-y)) / Float64(1.0 / Float64(z + -1.0)))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[Log[1 + (-y)], $MachinePrecision] / N[(1.0 / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) + \frac{\mathsf{log1p}\left(-y\right)}{\frac{1}{z + -1}}\right) - t
\end{array}
Initial program 90.1%
*-commutativeN/A
flip--N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
sub-negN/A
accelerator-lowering-log1p.f64N/A
neg-lowering-neg.f64N/A
clear-numN/A
flip--N/A
/-lowering-/.f64N/A
sub-negN/A
+-lowering-+.f64N/A
metadata-eval99.8
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ x -1.0)) (* (+ z -1.0) (* y (fma y (fma y -0.3333333333333333 -0.5) -1.0)))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) + ((z + -1.0) * (y * fma(y, fma(y, -0.3333333333333333, -0.5), -1.0)))) - t;
}
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(Float64(z + -1.0) * Float64(y * fma(y, fma(y, -0.3333333333333333, -0.5), -1.0)))) - 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[(y * N[(y * N[(y * -0.3333333333333333 + -0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) + \left(z + -1\right) \cdot \left(y \cdot \mathsf{fma}\left(y, \mathsf{fma}\left(y, -0.3333333333333333, -0.5\right), -1\right)\right)\right) - t
\end{array}
Initial program 90.1%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f6499.6
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (log y) (+ x -1.0) (- t))))
(if (<= (+ x -1.0) -500000.0)
t_1
(if (<= (+ x -1.0) -0.999998) (fma y (- 1.0 z) (- (- t) (log y))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(log(y), (x + -1.0), -t);
double tmp;
if ((x + -1.0) <= -500000.0) {
tmp = t_1;
} else if ((x + -1.0) <= -0.999998) {
tmp = fma(y, (1.0 - z), (-t - log(y)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(log(y), Float64(x + -1.0), Float64(-t)) tmp = 0.0 if (Float64(x + -1.0) <= -500000.0) tmp = t_1; elseif (Float64(x + -1.0) <= -0.999998) tmp = fma(y, Float64(1.0 - z), Float64(Float64(-t) - log(y))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision] + (-t)), $MachinePrecision]}, If[LessEqual[N[(x + -1.0), $MachinePrecision], -500000.0], t$95$1, If[LessEqual[N[(x + -1.0), $MachinePrecision], -0.999998], N[(y * N[(1.0 - z), $MachinePrecision] + N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\log y, x + -1, -t\right)\\
\mathbf{if}\;x + -1 \leq -500000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x + -1 \leq -0.999998:\\
\;\;\;\;\mathsf{fma}\left(y, 1 - z, \left(-t\right) - \log y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -5e5 or -0.999998000000000054 < (-.f64 x #s(literal 1 binary64)) Initial program 94.8%
Taylor expanded in y around 0
sub-negN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
neg-lowering-neg.f6494.0
Simplified94.0%
if -5e5 < (-.f64 x #s(literal 1 binary64)) < -0.999998000000000054Initial program 85.3%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f64100.0
Simplified100.0%
Taylor expanded in t around -inf
mul-1-negN/A
neg-lowering-neg.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
Simplified93.9%
Taylor expanded in y around 0
sub-negN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6499.6
Simplified99.6%
Taylor expanded in x around 0
mul-1-negN/A
neg-lowering-neg.f64N/A
log-lowering-log.f6499.6
Simplified99.6%
Final simplification96.8%
(FPCore (x y z t) :precision binary64 (- (fma y (* (+ z -1.0) (fma y -0.5 -1.0)) (* (log y) (+ x -1.0))) t))
double code(double x, double y, double z, double t) {
return fma(y, ((z + -1.0) * fma(y, -0.5, -1.0)), (log(y) * (x + -1.0))) - t;
}
function code(x, y, z, t) return Float64(fma(y, Float64(Float64(z + -1.0) * fma(y, -0.5, -1.0)), Float64(log(y) * Float64(x + -1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[(y * N[(N[(z + -1.0), $MachinePrecision] * N[(y * -0.5 + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \left(z + -1\right) \cdot \mathsf{fma}\left(y, -0.5, -1\right), \log y \cdot \left(x + -1\right)\right) - t
\end{array}
Initial program 90.1%
Taylor expanded in y around 0
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t)
:precision binary64
(if (<= (+ z -1.0) -2e+252)
(fma y (- 1.0 z) (* x (log y)))
(if (<= (+ z -1.0) 5e+167)
(- (fma (log y) (+ x -1.0) y) t)
(- (* (log1p (- y)) z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z + -1.0) <= -2e+252) {
tmp = fma(y, (1.0 - z), (x * log(y)));
} else if ((z + -1.0) <= 5e+167) {
tmp = fma(log(y), (x + -1.0), y) - t;
} else {
tmp = (log1p(-y) * z) - t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z + -1.0) <= -2e+252) tmp = fma(y, Float64(1.0 - z), Float64(x * log(y))); elseif (Float64(z + -1.0) <= 5e+167) tmp = Float64(fma(log(y), Float64(x + -1.0), y) - t); else tmp = Float64(Float64(log1p(Float64(-y)) * z) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z + -1.0), $MachinePrecision], -2e+252], N[(y * N[(1.0 - z), $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z + -1.0), $MachinePrecision], 5e+167], N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision] + y), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[1 + (-y)], $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z + -1 \leq -2 \cdot 10^{+252}:\\
\;\;\;\;\mathsf{fma}\left(y, 1 - z, x \cdot \log y\right)\\
\mathbf{elif}\;z + -1 \leq 5 \cdot 10^{+167}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x + -1, y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(-y\right) \cdot z - t\\
\end{array}
\end{array}
if (-.f64 z #s(literal 1 binary64)) < -2.0000000000000002e252Initial program 50.4%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f6499.9
Simplified99.9%
Taylor expanded in t around -inf
mul-1-negN/A
neg-lowering-neg.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
Simplified48.2%
Taylor expanded in y around 0
sub-negN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6499.3
Simplified99.3%
Taylor expanded in x around inf
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6481.7
Simplified81.7%
if -2.0000000000000002e252 < (-.f64 z #s(literal 1 binary64)) < 4.9999999999999997e167Initial program 98.1%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f6499.9
Simplified99.9%
Taylor expanded in t around -inf
mul-1-negN/A
neg-lowering-neg.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
Simplified87.9%
Taylor expanded in y around 0
sub-negN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6499.7
Simplified99.7%
Taylor expanded in z around 0
--lowering--.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6497.9
Simplified97.9%
if 4.9999999999999997e167 < (-.f64 z #s(literal 1 binary64)) Initial program 52.2%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-log1p.f64N/A
neg-lowering-neg.f6477.9
Simplified77.9%
Final simplification94.7%
(FPCore (x y z t) :precision binary64 (if (<= (+ z -1.0) 5e+167) (- (fma (log y) (+ x -1.0) y) t) (- (* (log1p (- y)) z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z + -1.0) <= 5e+167) {
tmp = fma(log(y), (x + -1.0), y) - t;
} else {
tmp = (log1p(-y) * z) - t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z + -1.0) <= 5e+167) tmp = Float64(fma(log(y), Float64(x + -1.0), y) - t); else tmp = Float64(Float64(log1p(Float64(-y)) * z) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z + -1.0), $MachinePrecision], 5e+167], N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision] + y), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[1 + (-y)], $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z + -1 \leq 5 \cdot 10^{+167}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x + -1, y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(-y\right) \cdot z - t\\
\end{array}
\end{array}
if (-.f64 z #s(literal 1 binary64)) < 4.9999999999999997e167Initial program 94.4%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f6499.9
Simplified99.9%
Taylor expanded in t around -inf
mul-1-negN/A
neg-lowering-neg.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
Simplified84.8%
Taylor expanded in y around 0
sub-negN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6499.7
Simplified99.7%
Taylor expanded in z around 0
--lowering--.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6494.0
Simplified94.0%
if 4.9999999999999997e167 < (-.f64 z #s(literal 1 binary64)) Initial program 52.2%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-log1p.f64N/A
neg-lowering-neg.f6477.9
Simplified77.9%
Final simplification92.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (* x (log y)) t))) (if (<= x -0.000106) t_1 (if (<= x 185.0) (fma y (- 1.0 z) (- t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x * log(y)) - t;
double tmp;
if (x <= -0.000106) {
tmp = t_1;
} else if (x <= 185.0) {
tmp = fma(y, (1.0 - z), -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 <= -0.000106) tmp = t_1; elseif (x <= 185.0) tmp = fma(y, Float64(1.0 - z), Float64(-t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[x, -0.000106], t$95$1, If[LessEqual[x, 185.0], N[(y * N[(1.0 - z), $MachinePrecision] + (-t)), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y - t\\
\mathbf{if}\;x \leq -0.000106:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 185:\\
\;\;\;\;\mathsf{fma}\left(y, 1 - z, -t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.06e-4 or 185 < x Initial program 94.7%
Taylor expanded in x around inf
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6493.2
Simplified93.2%
if -1.06e-4 < x < 185Initial program 85.4%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f64100.0
Simplified100.0%
Taylor expanded in t around -inf
mul-1-negN/A
neg-lowering-neg.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
Simplified94.0%
Taylor expanded in y around 0
sub-negN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6499.6
Simplified99.6%
Taylor expanded in t around inf
mul-1-negN/A
neg-lowering-neg.f6462.9
Simplified62.9%
Final simplification78.0%
(FPCore (x y z t) :precision binary64 (if (<= (+ z -1.0) 5e+167) (fma (log y) (+ x -1.0) (- t)) (- (* (log1p (- y)) z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z + -1.0) <= 5e+167) {
tmp = fma(log(y), (x + -1.0), -t);
} else {
tmp = (log1p(-y) * z) - t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z + -1.0) <= 5e+167) tmp = fma(log(y), Float64(x + -1.0), Float64(-t)); else tmp = Float64(Float64(log1p(Float64(-y)) * z) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z + -1.0), $MachinePrecision], 5e+167], N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision] + (-t)), $MachinePrecision], N[(N[(N[Log[1 + (-y)], $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z + -1 \leq 5 \cdot 10^{+167}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x + -1, -t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(-y\right) \cdot z - t\\
\end{array}
\end{array}
if (-.f64 z #s(literal 1 binary64)) < 4.9999999999999997e167Initial program 94.4%
Taylor expanded in y around 0
sub-negN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
neg-lowering-neg.f6493.8
Simplified93.8%
if 4.9999999999999997e167 < (-.f64 z #s(literal 1 binary64)) Initial program 52.2%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-log1p.f64N/A
neg-lowering-neg.f6477.9
Simplified77.9%
Final simplification92.2%
(FPCore (x y z t) :precision binary64 (- (fma y (- 1.0 z) (* (log y) (+ x -1.0))) t))
double code(double x, double y, double z, double t) {
return fma(y, (1.0 - z), (log(y) * (x + -1.0))) - t;
}
function code(x, y, z, t) return Float64(fma(y, Float64(1.0 - z), Float64(log(y) * Float64(x + -1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[(y * N[(1.0 - z), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 1 - z, \log y \cdot \left(x + -1\right)\right) - t
\end{array}
Initial program 90.1%
Taylor expanded in y around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
associate--r+N/A
metadata-evalN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f6499.4
Simplified99.4%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (log y)))) (if (<= x -4.4e+166) t_1 (if (<= x 1.85e+20) (fma y (- 1.0 z) (- t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (x <= -4.4e+166) {
tmp = t_1;
} else if (x <= 1.85e+20) {
tmp = fma(y, (1.0 - z), -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.4e+166) tmp = t_1; elseif (x <= 1.85e+20) tmp = fma(y, Float64(1.0 - z), Float64(-t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.4e+166], t$95$1, If[LessEqual[x, 1.85e+20], N[(y * N[(1.0 - z), $MachinePrecision] + (-t)), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -4.4 \cdot 10^{+166}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{+20}:\\
\;\;\;\;\mathsf{fma}\left(y, 1 - z, -t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4.3999999999999998e166 or 1.85e20 < x Initial program 95.1%
Taylor expanded in x around inf
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6477.5
Simplified77.5%
if -4.3999999999999998e166 < x < 1.85e20Initial program 87.1%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f6499.5
Simplified99.5%
Taylor expanded in t around -inf
mul-1-negN/A
neg-lowering-neg.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
Simplified91.8%
Taylor expanded in y around 0
sub-negN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6499.2
Simplified99.2%
Taylor expanded in t around inf
mul-1-negN/A
neg-lowering-neg.f6461.1
Simplified61.1%
Final simplification67.1%
(FPCore (x y z t) :precision binary64 (if (<= t -7.6e+18) (- t) (if (<= t 270.0) (- (* y z)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7.6e+18) {
tmp = -t;
} else if (t <= 270.0) {
tmp = -(y * z);
} else {
tmp = -t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-7.6d+18)) then
tmp = -t
else if (t <= 270.0d0) then
tmp = -(y * z)
else
tmp = -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7.6e+18) {
tmp = -t;
} else if (t <= 270.0) {
tmp = -(y * z);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -7.6e+18: tmp = -t elif t <= 270.0: tmp = -(y * z) else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -7.6e+18) tmp = Float64(-t); elseif (t <= 270.0) tmp = Float64(-Float64(y * z)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -7.6e+18) tmp = -t; elseif (t <= 270.0) tmp = -(y * z); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -7.6e+18], (-t), If[LessEqual[t, 270.0], (-N[(y * z), $MachinePrecision]), (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.6 \cdot 10^{+18}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 270:\\
\;\;\;\;-y \cdot z\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -7.6e18 or 270 < t Initial program 94.9%
Taylor expanded in t around inf
mul-1-negN/A
neg-lowering-neg.f6473.8
Simplified73.8%
if -7.6e18 < t < 270Initial program 85.7%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-log1p.f64N/A
neg-lowering-neg.f6417.6
Simplified17.6%
Taylor expanded in y around 0
mul-1-negN/A
neg-lowering-neg.f6416.9
Simplified16.9%
Final simplification44.0%
(FPCore (x y z t) :precision binary64 (fma y (- 1.0 z) (- t)))
double code(double x, double y, double z, double t) {
return fma(y, (1.0 - z), -t);
}
function code(x, y, z, t) return fma(y, Float64(1.0 - z), Float64(-t)) end
code[x_, y_, z_, t_] := N[(y * N[(1.0 - z), $MachinePrecision] + (-t)), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 1 - z, -t\right)
\end{array}
Initial program 90.1%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f6499.6
Simplified99.6%
Taylor expanded in t around -inf
mul-1-negN/A
neg-lowering-neg.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
Simplified83.5%
Taylor expanded in y around 0
sub-negN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6499.4
Simplified99.4%
Taylor expanded in t around inf
mul-1-negN/A
neg-lowering-neg.f6446.8
Simplified46.8%
(FPCore (x y z t) :precision binary64 (- (fma y z t)))
double code(double x, double y, double z, double t) {
return -fma(y, z, t);
}
function code(x, y, z, t) return Float64(-fma(y, z, t)) end
code[x_, y_, z_, t_] := (-N[(y * z + t), $MachinePrecision])
\begin{array}{l}
\\
-\mathsf{fma}\left(y, z, t\right)
\end{array}
Initial program 90.1%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-log1p.f64N/A
neg-lowering-neg.f6447.0
Simplified47.0%
Taylor expanded in y around 0
sub-negN/A
mul-1-negN/A
distribute-neg-outN/A
neg-lowering-neg.f64N/A
accelerator-lowering-fma.f6446.6
Simplified46.6%
(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.1%
Taylor expanded in t around inf
mul-1-negN/A
neg-lowering-neg.f6436.9
Simplified36.9%
herbie shell --seed 2024199
(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))