
(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 18 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 88.0%
*-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
(let* ((t_1 (- (* x (log y)) t))
(t_2 (+ (* (log y) (+ x -1.0)) (* (+ z -1.0) (log (- 1.0 y))))))
(if (<= t_2 -40000000000000.0)
t_1
(if (<= t_2 160.0)
(- (fma y (- z) y) t)
(if (<= t_2 2e+14) (- (- t) (log y)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x * log(y)) - t;
double t_2 = (log(y) * (x + -1.0)) + ((z + -1.0) * log((1.0 - y)));
double tmp;
if (t_2 <= -40000000000000.0) {
tmp = t_1;
} else if (t_2 <= 160.0) {
tmp = fma(y, -z, y) - t;
} else if (t_2 <= 2e+14) {
tmp = -t - log(y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x * log(y)) - t) t_2 = Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(Float64(z + -1.0) * log(Float64(1.0 - y)))) tmp = 0.0 if (t_2 <= -40000000000000.0) tmp = t_1; elseif (t_2 <= 160.0) tmp = Float64(fma(y, Float64(-z), y) - t); elseif (t_2 <= 2e+14) tmp = Float64(Float64(-t) - log(y)); 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]}, Block[{t$95$2 = N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(z + -1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -40000000000000.0], t$95$1, If[LessEqual[t$95$2, 160.0], N[(N[(y * (-z) + y), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$2, 2e+14], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y - t\\
t_2 := \log y \cdot \left(x + -1\right) + \left(z + -1\right) \cdot \log \left(1 - y\right)\\
\mathbf{if}\;t\_2 \leq -40000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 160:\\
\;\;\;\;\mathsf{fma}\left(y, -z, y\right) - t\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+14}:\\
\;\;\;\;\left(-t\right) - \log y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < -4e13 or 2e14 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) Initial program 96.2%
Taylor expanded in x around inf
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6493.7
Simplified93.7%
if -4e13 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 160Initial program 59.0%
Taylor expanded in t around -inf
mul-1-negN/A
neg-sub0N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
associate--r+N/A
neg-sub0N/A
--lowering--.f64N/A
Simplified92.5%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f6492.5
Simplified92.5%
Taylor expanded in y around -inf
associate-*r*N/A
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
neg-lowering-neg.f6489.0
Simplified89.0%
if 160 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 2e14Initial program 84.6%
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.f6484.6
Simplified84.6%
Taylor expanded in x around 0
sub-negN/A
mul-1-negN/A
distribute-neg-outN/A
neg-lowering-neg.f64N/A
+-lowering-+.f64N/A
log-lowering-log.f6484.1
Simplified84.1%
Final simplification89.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y)))
(t_2 (+ (* (log y) (+ x -1.0)) (* (+ z -1.0) (log (- 1.0 y))))))
(if (<= t_2 -4e+117)
t_1
(if (<= t_2 160.0)
(- (* z (* y (fma y (fma y -0.3333333333333333 -0.5) -1.0))) t)
(if (<= t_2 2e+95) (- (- t) (log y)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double t_2 = (log(y) * (x + -1.0)) + ((z + -1.0) * log((1.0 - y)));
double tmp;
if (t_2 <= -4e+117) {
tmp = t_1;
} else if (t_2 <= 160.0) {
tmp = (z * (y * fma(y, fma(y, -0.3333333333333333, -0.5), -1.0))) - t;
} else if (t_2 <= 2e+95) {
tmp = -t - log(y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * log(y)) t_2 = Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(Float64(z + -1.0) * log(Float64(1.0 - y)))) tmp = 0.0 if (t_2 <= -4e+117) tmp = t_1; elseif (t_2 <= 160.0) tmp = Float64(Float64(z * Float64(y * fma(y, fma(y, -0.3333333333333333, -0.5), -1.0))) - t); elseif (t_2 <= 2e+95) tmp = Float64(Float64(-t) - log(y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(z + -1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e+117], t$95$1, If[LessEqual[t$95$2, 160.0], N[(N[(z * N[(y * N[(y * N[(y * -0.3333333333333333 + -0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t$95$2, 2e+95], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := \log y \cdot \left(x + -1\right) + \left(z + -1\right) \cdot \log \left(1 - y\right)\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{+117}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 160:\\
\;\;\;\;z \cdot \left(y \cdot \mathsf{fma}\left(y, \mathsf{fma}\left(y, -0.3333333333333333, -0.5\right), -1\right)\right) - t\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+95}:\\
\;\;\;\;\left(-t\right) - \log y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < -4.0000000000000002e117 or 2.00000000000000004e95 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) Initial program 99.3%
Taylor expanded in x around inf
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6482.3
Simplified82.3%
if -4.0000000000000002e117 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 160Initial program 72.6%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-log1p.f64N/A
neg-lowering-neg.f6472.1
Simplified72.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.f6472.1
Simplified72.1%
if 160 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 2.00000000000000004e95Initial program 85.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.f6484.3
Simplified84.3%
Taylor expanded in x around 0
sub-negN/A
mul-1-negN/A
distribute-neg-outN/A
neg-lowering-neg.f64N/A
+-lowering-+.f64N/A
log-lowering-log.f6479.7
Simplified79.7%
Final simplification79.2%
(FPCore (x y z t) :precision binary64 (fma y (fma y (* (fma y -0.3333333333333333 -0.5) (+ z -1.0)) (- 1.0 z)) (fma (log y) (+ x -1.0) (- t))))
double code(double x, double y, double z, double t) {
return fma(y, fma(y, (fma(y, -0.3333333333333333, -0.5) * (z + -1.0)), (1.0 - z)), fma(log(y), (x + -1.0), -t));
}
function code(x, y, z, t) return fma(y, fma(y, Float64(fma(y, -0.3333333333333333, -0.5) * Float64(z + -1.0)), Float64(1.0 - z)), fma(log(y), Float64(x + -1.0), Float64(-t))) end
code[x_, y_, z_, t_] := N[(y * N[(y * N[(N[(y * -0.3333333333333333 + -0.5), $MachinePrecision] * N[(z + -1.0), $MachinePrecision]), $MachinePrecision] + N[(1.0 - z), $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, -0.3333333333333333, -0.5\right) \cdot \left(z + -1\right), 1 - z\right), \mathsf{fma}\left(\log y, x + -1, -t\right)\right)
\end{array}
Initial program 88.0%
Taylor expanded in y around 0
associate--l+N/A
accelerator-lowering-fma.f64N/A
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t)
:precision binary64
(if (<= (+ x -1.0) -2e+35)
(- (* x (log y)) t)
(if (<= (+ x -1.0) 20000000000.0)
(- (fma y (- 1.0 z) (- (log y))) t)
(fma (log y) (+ x -1.0) (- t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + -1.0) <= -2e+35) {
tmp = (x * log(y)) - t;
} else if ((x + -1.0) <= 20000000000.0) {
tmp = fma(y, (1.0 - z), -log(y)) - t;
} else {
tmp = fma(log(y), (x + -1.0), -t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(x + -1.0) <= -2e+35) tmp = Float64(Float64(x * log(y)) - t); elseif (Float64(x + -1.0) <= 20000000000.0) tmp = Float64(fma(y, Float64(1.0 - z), Float64(-log(y))) - t); else tmp = fma(log(y), Float64(x + -1.0), Float64(-t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + -1.0), $MachinePrecision], -2e+35], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(x + -1.0), $MachinePrecision], 20000000000.0], N[(N[(y * N[(1.0 - z), $MachinePrecision] + (-N[Log[y], $MachinePrecision])), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision] + (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + -1 \leq -2 \cdot 10^{+35}:\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{elif}\;x + -1 \leq 20000000000:\\
\;\;\;\;\mathsf{fma}\left(y, 1 - z, -\log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x + -1, -t\right)\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -1.9999999999999999e35Initial program 98.1%
Taylor expanded in x around inf
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6498.1
Simplified98.1%
if -1.9999999999999999e35 < (-.f64 x #s(literal 1 binary64)) < 2e10Initial program 79.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-+.f6498.6
Simplified98.6%
Taylor expanded in x around 0
mul-1-negN/A
neg-lowering-neg.f64N/A
log-lowering-log.f6498.2
Simplified98.2%
if 2e10 < (-.f64 x #s(literal 1 binary64)) Initial program 96.0%
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.f6495.2
Simplified95.2%
Final simplification97.5%
(FPCore (x y z t)
:precision binary64
(if (<= (+ z -1.0) -5e+155)
(fma y (fma y (* z (fma y -0.3333333333333333 -0.5)) (- z)) (- t))
(if (<= (+ z -1.0) 2e+90)
(- (- t) (log y))
(-
(* z (* y (fma y (fma y (fma y -0.25 -0.3333333333333333) -0.5) -1.0)))
t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z + -1.0) <= -5e+155) {
tmp = fma(y, fma(y, (z * fma(y, -0.3333333333333333, -0.5)), -z), -t);
} else if ((z + -1.0) <= 2e+90) {
tmp = -t - log(y);
} else {
tmp = (z * (y * fma(y, fma(y, fma(y, -0.25, -0.3333333333333333), -0.5), -1.0))) - t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z + -1.0) <= -5e+155) tmp = fma(y, fma(y, Float64(z * fma(y, -0.3333333333333333, -0.5)), Float64(-z)), Float64(-t)); elseif (Float64(z + -1.0) <= 2e+90) tmp = Float64(Float64(-t) - log(y)); else tmp = Float64(Float64(z * Float64(y * fma(y, fma(y, fma(y, -0.25, -0.3333333333333333), -0.5), -1.0))) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z + -1.0), $MachinePrecision], -5e+155], N[(y * N[(y * N[(z * N[(y * -0.3333333333333333 + -0.5), $MachinePrecision]), $MachinePrecision] + (-z)), $MachinePrecision] + (-t)), $MachinePrecision], If[LessEqual[N[(z + -1.0), $MachinePrecision], 2e+90], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[(z * N[(y * N[(y * N[(y * N[(y * -0.25 + -0.3333333333333333), $MachinePrecision] + -0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z + -1 \leq -5 \cdot 10^{+155}:\\
\;\;\;\;\mathsf{fma}\left(y, \mathsf{fma}\left(y, z \cdot \mathsf{fma}\left(y, -0.3333333333333333, -0.5\right), -z\right), -t\right)\\
\mathbf{elif}\;z + -1 \leq 2 \cdot 10^{+90}:\\
\;\;\;\;\left(-t\right) - \log y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, -0.25, -0.3333333333333333\right), -0.5\right), -1\right)\right) - t\\
\end{array}
\end{array}
if (-.f64 z #s(literal 1 binary64)) < -4.9999999999999999e155Initial program 64.4%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-log1p.f64N/A
neg-lowering-neg.f6469.9
Simplified69.9%
Taylor expanded in y around 0
sub-negN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-*r*N/A
distribute-rgt-outN/A
+-commutativeN/A
metadata-evalN/A
sub-negN/A
*-lowering-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
neg-lowering-neg.f6469.9
Simplified69.9%
if -4.9999999999999999e155 < (-.f64 z #s(literal 1 binary64)) < 1.99999999999999993e90Initial program 99.5%
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.f6498.9
Simplified98.9%
Taylor expanded in x around 0
sub-negN/A
mul-1-negN/A
distribute-neg-outN/A
neg-lowering-neg.f64N/A
+-lowering-+.f64N/A
log-lowering-log.f6462.3
Simplified62.3%
if 1.99999999999999993e90 < (-.f64 z #s(literal 1 binary64)) Initial program 64.3%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-log1p.f64N/A
neg-lowering-neg.f6452.5
Simplified52.5%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f6451.3
Simplified51.3%
Final simplification61.2%
(FPCore (x y z t) :precision binary64 (if (<= t -1.65e+23) (- (* z (* y (fma y -0.5 -1.0))) t) (if (<= t 4200000000000.0) (* (log y) (+ x -1.0)) (- (fma y z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.65e+23) {
tmp = (z * (y * fma(y, -0.5, -1.0))) - t;
} else if (t <= 4200000000000.0) {
tmp = log(y) * (x + -1.0);
} else {
tmp = -fma(y, z, t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= -1.65e+23) tmp = Float64(Float64(z * Float64(y * fma(y, -0.5, -1.0))) - t); elseif (t <= 4200000000000.0) tmp = Float64(log(y) * Float64(x + -1.0)); else tmp = Float64(-fma(y, z, t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.65e+23], N[(N[(z * N[(y * N[(y * -0.5 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t, 4200000000000.0], N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision], (-N[(y * z + t), $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.65 \cdot 10^{+23}:\\
\;\;\;\;z \cdot \left(y \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t\\
\mathbf{elif}\;t \leq 4200000000000:\\
\;\;\;\;\log y \cdot \left(x + -1\right)\\
\mathbf{else}:\\
\;\;\;\;-\mathsf{fma}\left(y, z, t\right)\\
\end{array}
\end{array}
if t < -1.65000000000000015e23Initial program 84.8%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-log1p.f64N/A
neg-lowering-neg.f6479.3
Simplified79.3%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f6479.3
Simplified79.3%
if -1.65000000000000015e23 < t < 4.2e12Initial program 85.6%
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.f6484.0
Simplified84.0%
Taylor expanded in t around 0
*-lowering-*.f64N/A
log-lowering-log.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6482.7
Simplified82.7%
if 4.2e12 < t Initial program 95.4%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-log1p.f64N/A
neg-lowering-neg.f6478.8
Simplified78.8%
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.f6478.8
Simplified78.8%
Final simplification81.0%
(FPCore (x y z t) :precision binary64 (if (<= (+ z -1.0) -5e+255) (- (fma y z t)) (fma (log y) (+ x -1.0) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z + -1.0) <= -5e+255) {
tmp = -fma(y, z, t);
} else {
tmp = fma(log(y), (x + -1.0), -t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z + -1.0) <= -5e+255) tmp = Float64(-fma(y, z, t)); else tmp = fma(log(y), Float64(x + -1.0), Float64(-t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z + -1.0), $MachinePrecision], -5e+255], (-N[(y * z + t), $MachinePrecision]), N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision] + (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z + -1 \leq -5 \cdot 10^{+255}:\\
\;\;\;\;-\mathsf{fma}\left(y, z, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x + -1, -t\right)\\
\end{array}
\end{array}
if (-.f64 z #s(literal 1 binary64)) < -5.0000000000000002e255Initial program 39.2%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-log1p.f64N/A
neg-lowering-neg.f6491.3
Simplified91.3%
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.f6491.3
Simplified91.3%
if -5.0000000000000002e255 < (-.f64 z #s(literal 1 binary64)) Initial program 90.2%
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.f6488.9
Simplified88.9%
Final simplification89.0%
(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 88.0%
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.1
Simplified99.1%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (- (* z (* y (fma y (fma y (fma y -0.25 -0.3333333333333333) -0.5) -1.0))) t))
double code(double x, double y, double z, double t) {
return (z * (y * fma(y, fma(y, fma(y, -0.25, -0.3333333333333333), -0.5), -1.0))) - t;
}
function code(x, y, z, t) return Float64(Float64(z * Float64(y * fma(y, fma(y, fma(y, -0.25, -0.3333333333333333), -0.5), -1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[(z * N[(y * N[(y * N[(y * N[(y * -0.25 + -0.3333333333333333), $MachinePrecision] + -0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(y \cdot \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, -0.25, -0.3333333333333333\right), -0.5\right), -1\right)\right) - t
\end{array}
Initial program 88.0%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-log1p.f64N/A
neg-lowering-neg.f6446.4
Simplified46.4%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f6446.1
Simplified46.1%
Final simplification46.1%
(FPCore (x y z t) :precision binary64 (fma y (fma y (* z (fma y -0.3333333333333333 -0.5)) (- z)) (- t)))
double code(double x, double y, double z, double t) {
return fma(y, fma(y, (z * fma(y, -0.3333333333333333, -0.5)), -z), -t);
}
function code(x, y, z, t) return fma(y, fma(y, Float64(z * fma(y, -0.3333333333333333, -0.5)), Float64(-z)), Float64(-t)) end
code[x_, y_, z_, t_] := N[(y * N[(y * N[(z * N[(y * -0.3333333333333333 + -0.5), $MachinePrecision]), $MachinePrecision] + (-z)), $MachinePrecision] + (-t)), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \mathsf{fma}\left(y, z \cdot \mathsf{fma}\left(y, -0.3333333333333333, -0.5\right), -z\right), -t\right)
\end{array}
Initial program 88.0%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-log1p.f64N/A
neg-lowering-neg.f6446.4
Simplified46.4%
Taylor expanded in y around 0
sub-negN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-*r*N/A
distribute-rgt-outN/A
+-commutativeN/A
metadata-evalN/A
sub-negN/A
*-lowering-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
neg-lowering-neg.f6446.1
Simplified46.1%
(FPCore (x y z t) :precision binary64 (- (* z (* y (fma y (fma y -0.3333333333333333 -0.5) -1.0))) t))
double code(double x, double y, double z, double t) {
return (z * (y * fma(y, fma(y, -0.3333333333333333, -0.5), -1.0))) - t;
}
function code(x, y, z, t) return Float64(Float64(z * Float64(y * fma(y, fma(y, -0.3333333333333333, -0.5), -1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[(z * N[(y * N[(y * N[(y * -0.3333333333333333 + -0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(y \cdot \mathsf{fma}\left(y, \mathsf{fma}\left(y, -0.3333333333333333, -0.5\right), -1\right)\right) - t
\end{array}
Initial program 88.0%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-log1p.f64N/A
neg-lowering-neg.f6446.4
Simplified46.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.f6446.1
Simplified46.1%
Final simplification46.1%
(FPCore (x y z t) :precision binary64 (if (<= t -3.2e+40) (- t) (if (<= t 6.8e+44) (* y (- z)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.2e+40) {
tmp = -t;
} else if (t <= 6.8e+44) {
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 <= (-3.2d+40)) then
tmp = -t
else if (t <= 6.8d+44) 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 <= -3.2e+40) {
tmp = -t;
} else if (t <= 6.8e+44) {
tmp = y * -z;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3.2e+40: tmp = -t elif t <= 6.8e+44: tmp = y * -z else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3.2e+40) tmp = Float64(-t); elseif (t <= 6.8e+44) tmp = Float64(y * Float64(-z)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -3.2e+40) tmp = -t; elseif (t <= 6.8e+44) tmp = y * -z; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.2e+40], (-t), If[LessEqual[t, 6.8e+44], N[(y * (-z)), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{+40}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 6.8 \cdot 10^{+44}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -3.19999999999999981e40 or 6.8e44 < t Initial program 94.9%
Taylor expanded in t around inf
mul-1-negN/A
neg-lowering-neg.f6474.1
Simplified74.1%
if -3.19999999999999981e40 < t < 6.8e44Initial program 82.8%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-log1p.f64N/A
neg-lowering-neg.f6421.7
Simplified21.7%
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.f6420.5
Simplified20.5%
Taylor expanded in y around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f6418.5
Simplified18.5%
(FPCore (x y z t) :precision binary64 (fma y (* z (fma y -0.5 -1.0)) (- t)))
double code(double x, double y, double z, double t) {
return fma(y, (z * fma(y, -0.5, -1.0)), -t);
}
function code(x, y, z, t) return fma(y, Float64(z * fma(y, -0.5, -1.0)), Float64(-t)) end
code[x_, y_, z_, t_] := N[(y * N[(z * N[(y * -0.5 + -1.0), $MachinePrecision]), $MachinePrecision] + (-t)), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, z \cdot \mathsf{fma}\left(y, -0.5, -1\right), -t\right)
\end{array}
Initial program 88.0%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-log1p.f64N/A
neg-lowering-neg.f6446.4
Simplified46.4%
Taylor expanded in y around 0
sub-negN/A
*-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
metadata-evalN/A
sub-negN/A
*-lowering-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
neg-lowering-neg.f6446.0
Simplified46.0%
(FPCore (x y z t) :precision binary64 (- (* z (* y (fma y -0.5 -1.0))) t))
double code(double x, double y, double z, double t) {
return (z * (y * fma(y, -0.5, -1.0))) - t;
}
function code(x, y, z, t) return Float64(Float64(z * Float64(y * fma(y, -0.5, -1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[(z * N[(y * N[(y * -0.5 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(y \cdot \mathsf{fma}\left(y, -0.5, -1\right)\right) - t
\end{array}
Initial program 88.0%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-log1p.f64N/A
neg-lowering-neg.f6446.4
Simplified46.4%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f6446.0
Simplified46.0%
Final simplification46.0%
(FPCore (x y z t) :precision binary64 (- (fma y (- z) y) t))
double code(double x, double y, double z, double t) {
return fma(y, -z, y) - t;
}
function code(x, y, z, t) return Float64(fma(y, Float64(-z), y) - t) end
code[x_, y_, z_, t_] := N[(N[(y * (-z) + y), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, -z, y\right) - t
\end{array}
Initial program 88.0%
Taylor expanded in t around -inf
mul-1-negN/A
neg-sub0N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
associate--r+N/A
neg-sub0N/A
--lowering--.f64N/A
Simplified83.8%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f6482.5
Simplified82.5%
Taylor expanded in y around -inf
associate-*r*N/A
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
neg-lowering-neg.f6445.7
Simplified45.7%
(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 88.0%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-log1p.f64N/A
neg-lowering-neg.f6446.4
Simplified46.4%
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.f6445.6
Simplified45.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 88.0%
Taylor expanded in t around inf
mul-1-negN/A
neg-lowering-neg.f6434.2
Simplified34.2%
herbie shell --seed 2024204
(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))