
(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 (/ 1.0 (/ 1.0 (fma (log1p (- y)) (- z 1.0) (fma (log y) (- x 1.0) (- t))))))
double code(double x, double y, double z, double t) {
return 1.0 / (1.0 / fma(log1p(-y), (z - 1.0), fma(log(y), (x - 1.0), -t)));
}
function code(x, y, z, t) return Float64(1.0 / Float64(1.0 / fma(log1p(Float64(-y)), Float64(z - 1.0), fma(log(y), Float64(x - 1.0), Float64(-t))))) end
code[x_, y_, z_, t_] := N[(1.0 / N[(1.0 / N[(N[Log[1 + (-y)], $MachinePrecision] * N[(z - 1.0), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{1}{\mathsf{fma}\left(\mathsf{log1p}\left(-y\right), z - 1, \mathsf{fma}\left(\log y, x - 1, -t\right)\right)}}
\end{array}
Initial program 86.9%
lift--.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
Applied rewrites99.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* (- x 1.0) (log y)) t)))
(if (<= (- x 1.0) -1.001058776007397)
t_1
(if (<= (- x 1.0) -0.99999999999995)
(- (fma (- 1.0 z) y (- (log y))) t)
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((x - 1.0) * log(y)) - t;
double tmp;
if ((x - 1.0) <= -1.001058776007397) {
tmp = t_1;
} else if ((x - 1.0) <= -0.99999999999995) {
tmp = fma((1.0 - z), y, -log(y)) - t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(Float64(x - 1.0) * log(y)) - t) tmp = 0.0 if (Float64(x - 1.0) <= -1.001058776007397) tmp = t_1; elseif (Float64(x - 1.0) <= -0.99999999999995) tmp = Float64(fma(Float64(1.0 - z), y, Float64(-log(y))) - t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[N[(x - 1.0), $MachinePrecision], -1.001058776007397], t$95$1, If[LessEqual[N[(x - 1.0), $MachinePrecision], -0.99999999999995], N[(N[(N[(1.0 - z), $MachinePrecision] * y + (-N[Log[y], $MachinePrecision])), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x - 1\right) \cdot \log y - t\\
\mathbf{if}\;x - 1 \leq -1.001058776007397:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x - 1 \leq -0.99999999999995:\\
\;\;\;\;\mathsf{fma}\left(1 - z, y, -\log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -1.001058776007397 or -0.99999999999995004 < (-.f64 x #s(literal 1 binary64)) Initial program 91.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6489.8
Applied rewrites89.8%
if -1.001058776007397 < (-.f64 x #s(literal 1 binary64)) < -0.99999999999995004Initial program 81.2%
Taylor expanded in y around 0
*-commutativeN/A
associate-*r*N/A
lower-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
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6499.5
Applied rewrites99.5%
Taylor expanded in x around 0
Applied rewrites99.5%
(FPCore (x y z t) :precision binary64 (- (fma (* (- z 1.0) y) (fma -0.5 y -1.0) (* (- x 1.0) (log y))) t))
double code(double x, double y, double z, double t) {
return fma(((z - 1.0) * y), fma(-0.5, y, -1.0), ((x - 1.0) * log(y))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(Float64(z - 1.0) * y), fma(-0.5, y, -1.0), Float64(Float64(x - 1.0) * log(y))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(z - 1.0), $MachinePrecision] * y), $MachinePrecision] * N[(-0.5 * y + -1.0), $MachinePrecision] + N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(z - 1\right) \cdot y, \mathsf{fma}\left(-0.5, y, -1\right), \left(x - 1\right) \cdot \log y\right) - t
\end{array}
Initial program 86.9%
Taylor expanded in y around 0
associate-*r*N/A
distribute-rgt-outN/A
+-commutativeN/A
metadata-evalN/A
sub-negN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6499.7
Applied rewrites99.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= x -4.6e+73)
t_1
(if (<= x -3.8e-46)
(- (* (* (fma -0.5 y -1.0) z) y) t)
(if (<= x 1.85e-79)
(- (- (log y)) t)
(if (<= x 4.6e+51)
(- (* (fma (* (fma -0.3333333333333333 y -0.5) z) y (- z)) 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.6e+73) {
tmp = t_1;
} else if (x <= -3.8e-46) {
tmp = ((fma(-0.5, y, -1.0) * z) * y) - t;
} else if (x <= 1.85e-79) {
tmp = -log(y) - t;
} else if (x <= 4.6e+51) {
tmp = (fma((fma(-0.3333333333333333, y, -0.5) * z), y, -z) * 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.6e+73) tmp = t_1; elseif (x <= -3.8e-46) tmp = Float64(Float64(Float64(fma(-0.5, y, -1.0) * z) * y) - t); elseif (x <= 1.85e-79) tmp = Float64(Float64(-log(y)) - t); elseif (x <= 4.6e+51) tmp = Float64(Float64(fma(Float64(fma(-0.3333333333333333, y, -0.5) * z), y, Float64(-z)) * y) - 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.6e+73], t$95$1, If[LessEqual[x, -3.8e-46], N[(N[(N[(N[(-0.5 * y + -1.0), $MachinePrecision] * z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[x, 1.85e-79], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision], If[LessEqual[x, 4.6e+51], N[(N[(N[(N[(N[(-0.3333333333333333 * y + -0.5), $MachinePrecision] * z), $MachinePrecision] * y + (-z)), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -4.6 \cdot 10^{+73}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -3.8 \cdot 10^{-46}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.5, y, -1\right) \cdot z\right) \cdot y - t\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-79}:\\
\;\;\;\;\left(-\log y\right) - t\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.3333333333333333, y, -0.5\right) \cdot z, y, -z\right) \cdot y - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4.6e73 or 4.6000000000000001e51 < x Initial program 94.7%
lift--.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
Applied rewrites99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6479.2
Applied rewrites79.2%
if -4.6e73 < x < -3.7999999999999997e-46Initial program 77.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6469.5
Applied rewrites69.5%
Taylor expanded in y around 0
Applied rewrites69.5%
if -3.7999999999999997e-46 < x < 1.85000000000000009e-79Initial program 84.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6483.6
Applied rewrites83.6%
Taylor expanded in x around 0
Applied rewrites83.6%
if 1.85000000000000009e-79 < x < 4.6000000000000001e51Initial program 69.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6473.8
Applied rewrites73.8%
Taylor expanded in y around 0
Applied rewrites73.8%
Final simplification79.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* (- x 1.0) (log y)) t)))
(if (<= t -5.8e-12)
t_1
(if (<= t 5.2e-9) (fma (- x 1.0) (log y) (* (- 1.0 z) y)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((x - 1.0) * log(y)) - t;
double tmp;
if (t <= -5.8e-12) {
tmp = t_1;
} else if (t <= 5.2e-9) {
tmp = fma((x - 1.0), log(y), ((1.0 - z) * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(Float64(x - 1.0) * log(y)) - t) tmp = 0.0 if (t <= -5.8e-12) tmp = t_1; elseif (t <= 5.2e-9) tmp = fma(Float64(x - 1.0), log(y), Float64(Float64(1.0 - z) * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[t, -5.8e-12], t$95$1, If[LessEqual[t, 5.2e-9], N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[(1.0 - z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x - 1\right) \cdot \log y - t\\
\mathbf{if}\;t \leq -5.8 \cdot 10^{-12}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(x - 1, \log y, \left(1 - z\right) \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.8000000000000003e-12 or 5.2000000000000002e-9 < t Initial program 93.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6491.6
Applied rewrites91.6%
if -5.8000000000000003e-12 < t < 5.2000000000000002e-9Initial program 80.6%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
Applied rewrites98.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x (log y)) t)))
(if (<= (- x 1.0) -2000.0)
t_1
(if (<= (- x 1.0) -0.999998) (- (- (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 - 1.0) <= -2000.0) {
tmp = t_1;
} else if ((x - 1.0) <= -0.999998) {
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 - 1.0d0) <= (-2000.0d0)) then
tmp = t_1
else if ((x - 1.0d0) <= (-0.999998d0)) 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 - 1.0) <= -2000.0) {
tmp = t_1;
} else if ((x - 1.0) <= -0.999998) {
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 - 1.0) <= -2000.0: tmp = t_1 elif (x - 1.0) <= -0.999998: 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 (Float64(x - 1.0) <= -2000.0) tmp = t_1; elseif (Float64(x - 1.0) <= -0.999998) 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 - 1.0) <= -2000.0) tmp = t_1; elseif ((x - 1.0) <= -0.999998) 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[N[(x - 1.0), $MachinePrecision], -2000.0], t$95$1, If[LessEqual[N[(x - 1.0), $MachinePrecision], -0.999998], 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 - 1 \leq -2000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x - 1 \leq -0.999998:\\
\;\;\;\;\left(-\log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -2e3 or -0.999998000000000054 < (-.f64 x #s(literal 1 binary64)) Initial program 91.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6488.1
Applied rewrites88.1%
if -2e3 < (-.f64 x #s(literal 1 binary64)) < -0.999998000000000054Initial program 81.5%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6480.5
Applied rewrites80.5%
Taylor expanded in x around 0
Applied rewrites79.9%
Final simplification84.3%
(FPCore (x y z t) :precision binary64 (if (<= (- z 1.0) -1e+162) (- (* z (log1p (- y))) t) (- (* (- x 1.0) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z - 1.0) <= -1e+162) {
tmp = (z * log1p(-y)) - t;
} else {
tmp = ((x - 1.0) * log(y)) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z - 1.0) <= -1e+162) {
tmp = (z * Math.log1p(-y)) - t;
} else {
tmp = ((x - 1.0) * Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z - 1.0) <= -1e+162: tmp = (z * math.log1p(-y)) - t else: tmp = ((x - 1.0) * math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z - 1.0) <= -1e+162) tmp = Float64(Float64(z * log1p(Float64(-y))) - t); else tmp = Float64(Float64(Float64(x - 1.0) * log(y)) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z - 1.0), $MachinePrecision], -1e+162], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z - 1 \leq -1 \cdot 10^{+162}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(x - 1\right) \cdot \log y - t\\
\end{array}
\end{array}
if (-.f64 z #s(literal 1 binary64)) < -9.9999999999999994e161Initial program 57.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6467.6
Applied rewrites67.6%
if -9.9999999999999994e161 < (-.f64 z #s(literal 1 binary64)) Initial program 92.2%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6491.3
Applied rewrites91.3%
Final simplification87.7%
(FPCore (x y z t) :precision binary64 (- (fma (- z) y (* (- x 1.0) (log y))) t))
double code(double x, double y, double z, double t) {
return fma(-z, y, ((x - 1.0) * log(y))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(-z), y, Float64(Float64(x - 1.0) * log(y))) - t) end
code[x_, y_, z_, t_] := N[(N[((-z) * y + N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-z, y, \left(x - 1\right) \cdot \log y\right) - t
\end{array}
Initial program 86.9%
Taylor expanded in y around 0
*-commutativeN/A
associate-*r*N/A
lower-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
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6499.0
Applied rewrites99.0%
Taylor expanded in z around inf
Applied rewrites99.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= x -4.6e+73)
t_1
(if (<= x 4.6e+51)
(- (* (fma (* (fma -0.3333333333333333 y -0.5) z) y (- z)) 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.6e+73) {
tmp = t_1;
} else if (x <= 4.6e+51) {
tmp = (fma((fma(-0.3333333333333333, y, -0.5) * z), y, -z) * 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.6e+73) tmp = t_1; elseif (x <= 4.6e+51) tmp = Float64(Float64(fma(Float64(fma(-0.3333333333333333, y, -0.5) * z), y, Float64(-z)) * y) - 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.6e+73], t$95$1, If[LessEqual[x, 4.6e+51], N[(N[(N[(N[(N[(-0.3333333333333333 * y + -0.5), $MachinePrecision] * z), $MachinePrecision] * y + (-z)), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -4.6 \cdot 10^{+73}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+51}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.3333333333333333, y, -0.5\right) \cdot z, y, -z\right) \cdot y - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4.6e73 or 4.6000000000000001e51 < x Initial program 94.7%
lift--.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
Applied rewrites99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6479.2
Applied rewrites79.2%
if -4.6e73 < x < 4.6000000000000001e51Initial program 80.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6464.6
Applied rewrites64.6%
Taylor expanded in y around 0
Applied rewrites64.6%
Final simplification70.9%
(FPCore (x y z t) :precision binary64 (- (* (* (fma (fma (fma -0.25 y -0.3333333333333333) y -0.5) y -1.0) y) z) t))
double code(double x, double y, double z, double t) {
return ((fma(fma(fma(-0.25, y, -0.3333333333333333), y, -0.5), y, -1.0) * y) * z) - t;
}
function code(x, y, z, t) return Float64(Float64(Float64(fma(fma(fma(-0.25, y, -0.3333333333333333), y, -0.5), y, -1.0) * y) * z) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(N[(-0.25 * y + -0.3333333333333333), $MachinePrecision] * y + -0.5), $MachinePrecision] * y + -1.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), y, -0.5\right), y, -1\right) \cdot y\right) \cdot z - t
\end{array}
Initial program 86.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6446.5
Applied rewrites46.5%
Taylor expanded in y around 0
Applied rewrites46.4%
(FPCore (x y z t) :precision binary64 (- (* (fma (* (fma -0.3333333333333333 y -0.5) y) y (- y)) z) t))
double code(double x, double y, double z, double t) {
return (fma((fma(-0.3333333333333333, y, -0.5) * y), y, -y) * z) - t;
}
function code(x, y, z, t) return Float64(Float64(fma(Float64(fma(-0.3333333333333333, y, -0.5) * y), y, Float64(-y)) * z) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(-0.3333333333333333 * y + -0.5), $MachinePrecision] * y), $MachinePrecision] * y + (-y)), $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(-0.3333333333333333, y, -0.5\right) \cdot y, y, -y\right) \cdot z - t
\end{array}
Initial program 86.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6446.5
Applied rewrites46.5%
Taylor expanded in y around 0
Applied rewrites46.4%
Applied rewrites46.4%
(FPCore (x y z t) :precision binary64 (- (* (fma (* (fma -0.3333333333333333 y -0.5) z) y (- z)) y) t))
double code(double x, double y, double z, double t) {
return (fma((fma(-0.3333333333333333, y, -0.5) * z), y, -z) * y) - t;
}
function code(x, y, z, t) return Float64(Float64(fma(Float64(fma(-0.3333333333333333, y, -0.5) * z), y, Float64(-z)) * y) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(-0.3333333333333333 * y + -0.5), $MachinePrecision] * z), $MachinePrecision] * y + (-z)), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(-0.3333333333333333, y, -0.5\right) \cdot z, y, -z\right) \cdot y - t
\end{array}
Initial program 86.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6446.5
Applied rewrites46.5%
Taylor expanded in y around 0
Applied rewrites46.4%
Final simplification46.4%
(FPCore (x y z t) :precision binary64 (- (* (* (fma (fma -0.3333333333333333 y -0.5) y -1.0) y) z) t))
double code(double x, double y, double z, double t) {
return ((fma(fma(-0.3333333333333333, y, -0.5), y, -1.0) * y) * z) - t;
}
function code(x, y, z, t) return Float64(Float64(Float64(fma(fma(-0.3333333333333333, y, -0.5), y, -1.0) * y) * z) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(-0.3333333333333333 * y + -0.5), $MachinePrecision] * y + -1.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.3333333333333333, y, -0.5\right), y, -1\right) \cdot y\right) \cdot z - t
\end{array}
Initial program 86.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6446.5
Applied rewrites46.5%
Taylor expanded in y around 0
Applied rewrites46.4%
(FPCore (x y z t) :precision binary64 (- (* (* (fma -0.5 y -1.0) y) z) t))
double code(double x, double y, double z, double t) {
return ((fma(-0.5, y, -1.0) * y) * z) - t;
}
function code(x, y, z, t) return Float64(Float64(Float64(fma(-0.5, y, -1.0) * y) * z) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(-0.5 * y + -1.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\mathsf{fma}\left(-0.5, y, -1\right) \cdot y\right) \cdot z - t
\end{array}
Initial program 86.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6446.5
Applied rewrites46.5%
Taylor expanded in y around 0
Applied rewrites46.3%
(FPCore (x y z t) :precision binary64 (- (* (* (fma -0.5 y -1.0) z) y) t))
double code(double x, double y, double z, double t) {
return ((fma(-0.5, y, -1.0) * z) * y) - t;
}
function code(x, y, z, t) return Float64(Float64(Float64(fma(-0.5, y, -1.0) * z) * y) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(-0.5 * y + -1.0), $MachinePrecision] * z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\mathsf{fma}\left(-0.5, y, -1\right) \cdot z\right) \cdot y - t
\end{array}
Initial program 86.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6446.5
Applied rewrites46.5%
Taylor expanded in y around 0
Applied rewrites46.3%
Final simplification46.3%
(FPCore (x y z t) :precision binary64 (- (* (- 1.0 z) y) t))
double code(double x, double y, double z, double t) {
return ((1.0 - z) * y) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((1.0d0 - z) * y) - t
end function
public static double code(double x, double y, double z, double t) {
return ((1.0 - z) * y) - t;
}
def code(x, y, z, t): return ((1.0 - z) * y) - t
function code(x, y, z, t) return Float64(Float64(Float64(1.0 - z) * y) - t) end
function tmp = code(x, y, z, t) tmp = ((1.0 - z) * y) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(1.0 - z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(1 - z\right) \cdot y - t
\end{array}
Initial program 86.9%
Taylor expanded in y around 0
*-commutativeN/A
associate-*r*N/A
lower-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
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6499.0
Applied rewrites99.0%
Taylor expanded in y around inf
Applied rewrites45.7%
(FPCore (x y z t) :precision binary64 (- (* (- y) z) t))
double code(double x, double y, double z, double t) {
return (-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 = (-y * z) - t
end function
public static double code(double x, double y, double z, double t) {
return (-y * z) - t;
}
def code(x, y, z, t): return (-y * z) - t
function code(x, y, z, t) return Float64(Float64(Float64(-y) * z) - t) end
function tmp = code(x, y, z, t) tmp = (-y * z) - t; end
code[x_, y_, z_, t_] := N[(N[((-y) * z), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(-y\right) \cdot z - t
\end{array}
Initial program 86.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6446.5
Applied rewrites46.5%
Taylor expanded in y around 0
Applied rewrites45.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 86.9%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6432.6
Applied rewrites32.6%
herbie shell --seed 2024332
(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))