
(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 15 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 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (* (- (* (- (* -0.3333333333333333 y) 0.5) y) 1.0) y))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * (((((-0.3333333333333333 * y) - 0.5) * y) - 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) * ((((((-0.3333333333333333d0) * y) - 0.5d0) * y) - 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) * (((((-0.3333333333333333 * y) - 0.5) * y) - 1.0) * y))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * (((((-0.3333333333333333 * y) - 0.5) * y) - 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) * Float64(Float64(Float64(Float64(Float64(-0.3333333333333333 * y) - 0.5) * y) - 1.0) * y))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * (((((-0.3333333333333333 * y) - 0.5) * y) - 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[(N[(N[(N[(N[(-0.3333333333333333 * y), $MachinePrecision] - 0.5), $MachinePrecision] * y), $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\left(\left(-0.3333333333333333 \cdot y - 0.5\right) \cdot y - 1\right) \cdot y\right)\right) - t
\end{array}
Initial program 89.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6499.5
Applied rewrites99.5%
(FPCore (x y z t) :precision binary64 (- (fma (+ -1.0 x) (log y) (* (fma (* (- z 1.0) (fma -0.3333333333333333 y -0.5)) y (- (- z 1.0))) y)) t))
double code(double x, double y, double z, double t) {
return fma((-1.0 + x), log(y), (fma(((z - 1.0) * fma(-0.3333333333333333, y, -0.5)), y, -(z - 1.0)) * y)) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(-1.0 + x), log(y), Float64(fma(Float64(Float64(z - 1.0) * fma(-0.3333333333333333, y, -0.5)), y, Float64(-Float64(z - 1.0))) * y)) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[(N[(N[(z - 1.0), $MachinePrecision] * N[(-0.3333333333333333 * y + -0.5), $MachinePrecision]), $MachinePrecision] * y + (-N[(z - 1.0), $MachinePrecision])), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-1 + x, \log y, \mathsf{fma}\left(\left(z - 1\right) \cdot \mathsf{fma}\left(-0.3333333333333333, y, -0.5\right), y, -\left(z - 1\right)\right) \cdot y\right) - t
\end{array}
Initial program 89.7%
Taylor expanded in y around 0
+-commutativeN/A
Applied rewrites99.5%
(FPCore (x y z t) :precision binary64 (- (fma (+ -1.0 x) (log y) (* (* (- z 1.0) y) (fma -0.5 y -1.0))) t))
double code(double x, double y, double z, double t) {
return fma((-1.0 + x), log(y), (((z - 1.0) * y) * fma(-0.5, y, -1.0))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(-1.0 + x), log(y), Float64(Float64(Float64(z - 1.0) * y) * fma(-0.5, y, -1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[(N[(z - 1.0), $MachinePrecision] * y), $MachinePrecision] * N[(-0.5 * y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-1 + x, \log y, \left(\left(z - 1\right) \cdot y\right) \cdot \mathsf{fma}\left(-0.5, y, -1\right)\right) - t
\end{array}
Initial program 89.7%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
Applied rewrites99.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4e-10) (not (<= x 9.5e-6))) (- (* (+ -1.0 x) (log y)) t) (- (+ (fma (- z 1.0) y (log y)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4e-10) || !(x <= 9.5e-6)) {
tmp = ((-1.0 + x) * log(y)) - t;
} else {
tmp = -(fma((z - 1.0), y, log(y)) + t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((x <= -4e-10) || !(x <= 9.5e-6)) tmp = Float64(Float64(Float64(-1.0 + x) * log(y)) - t); else tmp = Float64(-Float64(fma(Float64(z - 1.0), y, log(y)) + t)); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4e-10], N[Not[LessEqual[x, 9.5e-6]], $MachinePrecision]], N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], (-N[(N[(N[(z - 1.0), $MachinePrecision] * y + N[Log[y], $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-10} \lor \neg \left(x \leq 9.5 \cdot 10^{-6}\right):\\
\;\;\;\;\left(-1 + x\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;-\left(\mathsf{fma}\left(z - 1, y, \log y\right) + t\right)\\
\end{array}
\end{array}
if x < -4.00000000000000015e-10 or 9.5000000000000005e-6 < x Initial program 95.7%
Taylor expanded in y around 0
remove-double-negN/A
log-recN/A
mul-1-negN/A
distribute-rgt-out--N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
+-commutativeN/A
distribute-rgt-outN/A
remove-double-negN/A
log-recN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
mul-1-negN/A
log-recN/A
Applied rewrites95.4%
if -4.00000000000000015e-10 < x < 9.5000000000000005e-6Initial program 81.9%
Taylor expanded in y around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower--.f64N/A
*-rgt-identityN/A
fp-cancel-sub-sign-invN/A
Applied rewrites98.7%
Taylor expanded in x around 0
Applied rewrites98.7%
Final simplification96.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (- x 1.0) -40000000.0) (not (<= (- x 1.0) -0.5))) (- (* (log y) x) t) (- (- y (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x - 1.0) <= -40000000.0) || !((x - 1.0) <= -0.5)) {
tmp = (log(y) * x) - t;
} else {
tmp = (y - log(y)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x - 1.0d0) <= (-40000000.0d0)) .or. (.not. ((x - 1.0d0) <= (-0.5d0)))) then
tmp = (log(y) * x) - t
else
tmp = (y - log(y)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x - 1.0) <= -40000000.0) || !((x - 1.0) <= -0.5)) {
tmp = (Math.log(y) * x) - t;
} else {
tmp = (y - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x - 1.0) <= -40000000.0) or not ((x - 1.0) <= -0.5): tmp = (math.log(y) * x) - t else: tmp = (y - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x - 1.0) <= -40000000.0) || !(Float64(x - 1.0) <= -0.5)) tmp = Float64(Float64(log(y) * x) - t); else tmp = Float64(Float64(y - log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x - 1.0) <= -40000000.0) || ~(((x - 1.0) <= -0.5))) tmp = (log(y) * x) - t; else tmp = (y - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x - 1.0), $MachinePrecision], -40000000.0], N[Not[LessEqual[N[(x - 1.0), $MachinePrecision], -0.5]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - t), $MachinePrecision], N[(N[(y - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x - 1 \leq -40000000 \lor \neg \left(x - 1 \leq -0.5\right):\\
\;\;\;\;\log y \cdot x - t\\
\mathbf{else}:\\
\;\;\;\;\left(y - \log y\right) - t\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -4e7 or -0.5 < (-.f64 x #s(literal 1 binary64)) Initial program 95.6%
Taylor expanded in x around inf
*-commutativeN/A
remove-double-negN/A
log-recN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f6495.3
Applied rewrites95.3%
if -4e7 < (-.f64 x #s(literal 1 binary64)) < -0.5Initial program 82.8%
Taylor expanded in y around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower--.f64N/A
*-rgt-identityN/A
fp-cancel-sub-sign-invN/A
Applied rewrites98.4%
Taylor expanded in z around 0
Applied rewrites80.8%
Taylor expanded in x around 0
Applied rewrites78.6%
Final simplification87.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x)))
(if (<= x -1.5e+22)
t_1
(if (<= x 2.4e-37)
(- (- y (log y)) t)
(if (<= x 1.5e+58) (- (* (* (- (* -0.5 y) 1.0) z) y) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double tmp;
if (x <= -1.5e+22) {
tmp = t_1;
} else if (x <= 2.4e-37) {
tmp = (y - log(y)) - t;
} else if (x <= 1.5e+58) {
tmp = ((((-0.5 * y) - 1.0) * z) * 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 = log(y) * x
if (x <= (-1.5d+22)) then
tmp = t_1
else if (x <= 2.4d-37) then
tmp = (y - log(y)) - t
else if (x <= 1.5d+58) then
tmp = (((((-0.5d0) * y) - 1.0d0) * z) * 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 = Math.log(y) * x;
double tmp;
if (x <= -1.5e+22) {
tmp = t_1;
} else if (x <= 2.4e-37) {
tmp = (y - Math.log(y)) - t;
} else if (x <= 1.5e+58) {
tmp = ((((-0.5 * y) - 1.0) * z) * y) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * x tmp = 0 if x <= -1.5e+22: tmp = t_1 elif x <= 2.4e-37: tmp = (y - math.log(y)) - t elif x <= 1.5e+58: tmp = ((((-0.5 * y) - 1.0) * z) * y) - t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * x) tmp = 0.0 if (x <= -1.5e+22) tmp = t_1; elseif (x <= 2.4e-37) tmp = Float64(Float64(y - log(y)) - t); elseif (x <= 1.5e+58) tmp = Float64(Float64(Float64(Float64(Float64(-0.5 * y) - 1.0) * z) * y) - t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * x; tmp = 0.0; if (x <= -1.5e+22) tmp = t_1; elseif (x <= 2.4e-37) tmp = (y - log(y)) - t; elseif (x <= 1.5e+58) tmp = ((((-0.5 * y) - 1.0) * z) * y) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -1.5e+22], t$95$1, If[LessEqual[x, 2.4e-37], N[(N[(y - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[x, 1.5e+58], N[(N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -1.5 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-37}:\\
\;\;\;\;\left(y - \log y\right) - t\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+58}:\\
\;\;\;\;\left(\left(-0.5 \cdot y - 1\right) \cdot z\right) \cdot y - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.5e22 or 1.5000000000000001e58 < x Initial program 96.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
Applied rewrites99.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6477.4
Applied rewrites77.4%
if -1.5e22 < x < 2.39999999999999991e-37Initial program 85.1%
Taylor expanded in y around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower--.f64N/A
*-rgt-identityN/A
fp-cancel-sub-sign-invN/A
Applied rewrites98.4%
Taylor expanded in z around 0
Applied rewrites83.0%
Taylor expanded in x around 0
Applied rewrites80.6%
if 2.39999999999999991e-37 < x < 1.5000000000000001e58Initial program 73.2%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
Applied rewrites99.8%
Taylor expanded in z around inf
Applied rewrites71.0%
Final simplification78.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x)))
(if (<= x -1.5e+22)
t_1
(if (<= x 2.4e-37)
(- (+ (log y) t))
(if (<= x 1.5e+58) (- (* (* (- (* -0.5 y) 1.0) z) y) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double tmp;
if (x <= -1.5e+22) {
tmp = t_1;
} else if (x <= 2.4e-37) {
tmp = -(log(y) + t);
} else if (x <= 1.5e+58) {
tmp = ((((-0.5 * y) - 1.0) * z) * 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 = log(y) * x
if (x <= (-1.5d+22)) then
tmp = t_1
else if (x <= 2.4d-37) then
tmp = -(log(y) + t)
else if (x <= 1.5d+58) then
tmp = (((((-0.5d0) * y) - 1.0d0) * z) * 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 = Math.log(y) * x;
double tmp;
if (x <= -1.5e+22) {
tmp = t_1;
} else if (x <= 2.4e-37) {
tmp = -(Math.log(y) + t);
} else if (x <= 1.5e+58) {
tmp = ((((-0.5 * y) - 1.0) * z) * y) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * x tmp = 0 if x <= -1.5e+22: tmp = t_1 elif x <= 2.4e-37: tmp = -(math.log(y) + t) elif x <= 1.5e+58: tmp = ((((-0.5 * y) - 1.0) * z) * y) - t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * x) tmp = 0.0 if (x <= -1.5e+22) tmp = t_1; elseif (x <= 2.4e-37) tmp = Float64(-Float64(log(y) + t)); elseif (x <= 1.5e+58) tmp = Float64(Float64(Float64(Float64(Float64(-0.5 * y) - 1.0) * z) * y) - t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * x; tmp = 0.0; if (x <= -1.5e+22) tmp = t_1; elseif (x <= 2.4e-37) tmp = -(log(y) + t); elseif (x <= 1.5e+58) tmp = ((((-0.5 * y) - 1.0) * z) * y) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -1.5e+22], t$95$1, If[LessEqual[x, 2.4e-37], (-N[(N[Log[y], $MachinePrecision] + t), $MachinePrecision]), If[LessEqual[x, 1.5e+58], N[(N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -1.5 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-37}:\\
\;\;\;\;-\left(\log y + t\right)\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+58}:\\
\;\;\;\;\left(\left(-0.5 \cdot y - 1\right) \cdot z\right) \cdot y - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.5e22 or 1.5000000000000001e58 < x Initial program 96.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
Applied rewrites99.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6477.4
Applied rewrites77.4%
if -1.5e22 < x < 2.39999999999999991e-37Initial program 85.1%
lift-*.f64N/A
lift--.f64N/A
flip--N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
difference-of-squares-revN/A
difference-of-sqr--1-revN/A
metadata-evalN/A
lower-fma.f64N/A
metadata-evalN/A
+-commutativeN/A
lower-+.f6485.0
Applied rewrites85.0%
Taylor expanded in y around 0
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f64N/A
lower-log.f64N/A
lower-+.f6482.6
Applied rewrites82.6%
Taylor expanded in x around 0
Applied rewrites80.2%
if 2.39999999999999991e-37 < x < 1.5000000000000001e58Initial program 73.2%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
Applied rewrites99.8%
Taylor expanded in z around inf
Applied rewrites71.0%
Final simplification78.1%
(FPCore (x y z t) :precision binary64 (if (<= (- z 1.0) 1e+269) (- (fma (log y) (- x 1.0) y) t) (- (* (* (- (* -0.5 y) 1.0) z) y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z - 1.0) <= 1e+269) {
tmp = fma(log(y), (x - 1.0), y) - t;
} else {
tmp = ((((-0.5 * y) - 1.0) * z) * y) - t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z - 1.0) <= 1e+269) tmp = Float64(fma(log(y), Float64(x - 1.0), y) - t); else tmp = Float64(Float64(Float64(Float64(Float64(-0.5 * y) - 1.0) * z) * y) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z - 1.0), $MachinePrecision], 1e+269], N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision] + y), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z - 1 \leq 10^{+269}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x - 1, y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-0.5 \cdot y - 1\right) \cdot z\right) \cdot y - t\\
\end{array}
\end{array}
if (-.f64 z #s(literal 1 binary64)) < 1e269Initial program 91.6%
Taylor expanded in y around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower--.f64N/A
*-rgt-identityN/A
fp-cancel-sub-sign-invN/A
Applied rewrites99.3%
Taylor expanded in z around 0
Applied rewrites90.9%
if 1e269 < (-.f64 z #s(literal 1 binary64)) Initial program 42.8%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
Applied rewrites97.6%
Taylor expanded in z around inf
Applied rewrites78.2%
(FPCore (x y z t) :precision binary64 (if (<= (- z 1.0) 1e+269) (- (* (+ -1.0 x) (log y)) t) (- (* (* (- (* -0.5 y) 1.0) z) y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z - 1.0) <= 1e+269) {
tmp = ((-1.0 + x) * log(y)) - t;
} else {
tmp = ((((-0.5 * y) - 1.0) * 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 ((z - 1.0d0) <= 1d+269) then
tmp = (((-1.0d0) + x) * log(y)) - t
else
tmp = (((((-0.5d0) * y) - 1.0d0) * z) * y) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z - 1.0) <= 1e+269) {
tmp = ((-1.0 + x) * Math.log(y)) - t;
} else {
tmp = ((((-0.5 * y) - 1.0) * z) * y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z - 1.0) <= 1e+269: tmp = ((-1.0 + x) * math.log(y)) - t else: tmp = ((((-0.5 * y) - 1.0) * z) * y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z - 1.0) <= 1e+269) tmp = Float64(Float64(Float64(-1.0 + x) * log(y)) - t); else tmp = Float64(Float64(Float64(Float64(Float64(-0.5 * y) - 1.0) * z) * y) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z - 1.0) <= 1e+269) tmp = ((-1.0 + x) * log(y)) - t; else tmp = ((((-0.5 * y) - 1.0) * z) * y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z - 1.0), $MachinePrecision], 1e+269], N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z - 1 \leq 10^{+269}:\\
\;\;\;\;\left(-1 + x\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-0.5 \cdot y - 1\right) \cdot z\right) \cdot y - t\\
\end{array}
\end{array}
if (-.f64 z #s(literal 1 binary64)) < 1e269Initial program 91.6%
Taylor expanded in y around 0
remove-double-negN/A
log-recN/A
mul-1-negN/A
distribute-rgt-out--N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
+-commutativeN/A
distribute-rgt-outN/A
remove-double-negN/A
log-recN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
mul-1-negN/A
log-recN/A
Applied rewrites90.7%
if 1e269 < (-.f64 z #s(literal 1 binary64)) Initial program 42.8%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
Applied rewrites97.6%
Taylor expanded in z around inf
Applied rewrites78.2%
(FPCore (x y z t) :precision binary64 (- (fma (- y) z (fma (log y) (- x 1.0) y)) t))
double code(double x, double y, double z, double t) {
return fma(-y, z, fma(log(y), (x - 1.0), y)) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(-y), z, fma(log(y), Float64(x - 1.0), y)) - t) end
code[x_, y_, z_, t_] := N[(N[((-y) * z + N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-y, z, \mathsf{fma}\left(\log y, x - 1, y\right)\right) - t
\end{array}
Initial program 89.7%
Taylor expanded in y around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower--.f64N/A
*-rgt-identityN/A
fp-cancel-sub-sign-invN/A
Applied rewrites99.1%
Taylor expanded in z around 0
Applied rewrites99.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.4e+23) (not (<= x 1.5e+58))) (* (log y) x) (- (* (* (- (* -0.5 y) 1.0) z) y) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.4e+23) || !(x <= 1.5e+58)) {
tmp = log(y) * x;
} else {
tmp = ((((-0.5 * y) - 1.0) * 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 ((x <= (-2.4d+23)) .or. (.not. (x <= 1.5d+58))) then
tmp = log(y) * x
else
tmp = (((((-0.5d0) * y) - 1.0d0) * z) * y) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.4e+23) || !(x <= 1.5e+58)) {
tmp = Math.log(y) * x;
} else {
tmp = ((((-0.5 * y) - 1.0) * z) * y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.4e+23) or not (x <= 1.5e+58): tmp = math.log(y) * x else: tmp = ((((-0.5 * y) - 1.0) * z) * y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.4e+23) || !(x <= 1.5e+58)) tmp = Float64(log(y) * x); else tmp = Float64(Float64(Float64(Float64(Float64(-0.5 * y) - 1.0) * z) * y) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.4e+23) || ~((x <= 1.5e+58))) tmp = log(y) * x; else tmp = ((((-0.5 * y) - 1.0) * z) * y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.4e+23], N[Not[LessEqual[x, 1.5e+58]], $MachinePrecision]], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{+23} \lor \neg \left(x \leq 1.5 \cdot 10^{+58}\right):\\
\;\;\;\;\log y \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-0.5 \cdot y - 1\right) \cdot z\right) \cdot y - t\\
\end{array}
\end{array}
if x < -2.4e23 or 1.5000000000000001e58 < x Initial program 96.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
Applied rewrites99.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6477.4
Applied rewrites77.4%
if -2.4e23 < x < 1.5000000000000001e58Initial program 83.3%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
Applied rewrites99.0%
Taylor expanded in z around inf
Applied rewrites59.1%
Final simplification67.9%
(FPCore (x y z t) :precision binary64 (- (* (* (- (* -0.5 y) 1.0) z) y) t))
double code(double x, double y, double z, double t) {
return ((((-0.5 * y) - 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 = (((((-0.5d0) * y) - 1.0d0) * z) * y) - t
end function
public static double code(double x, double y, double z, double t) {
return ((((-0.5 * y) - 1.0) * z) * y) - t;
}
def code(x, y, z, t): return ((((-0.5 * y) - 1.0) * z) * y) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(Float64(-0.5 * y) - 1.0) * z) * y) - t) end
function tmp = code(x, y, z, t) tmp = ((((-0.5 * y) - 1.0) * z) * y) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision] * y), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(-0.5 \cdot y - 1\right) \cdot z\right) \cdot y - t
\end{array}
Initial program 89.7%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
Applied rewrites99.3%
Taylor expanded in z around inf
Applied rewrites41.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1e+44) (not (<= t 1.52e+29))) (- t) (fma (- y) z y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1e+44) || !(t <= 1.52e+29)) {
tmp = -t;
} else {
tmp = fma(-y, z, y);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((t <= -1e+44) || !(t <= 1.52e+29)) tmp = Float64(-t); else tmp = fma(Float64(-y), z, y); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1e+44], N[Not[LessEqual[t, 1.52e+29]], $MachinePrecision]], (-t), N[((-y) * z + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{+44} \lor \neg \left(t \leq 1.52 \cdot 10^{+29}\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, z, y\right)\\
\end{array}
\end{array}
if t < -1.0000000000000001e44 or 1.52e29 < t Initial program 97.7%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6469.1
Applied rewrites69.1%
if -1.0000000000000001e44 < t < 1.52e29Initial program 83.6%
Taylor expanded in y around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower--.f64N/A
*-rgt-identityN/A
fp-cancel-sub-sign-invN/A
Applied rewrites98.8%
Taylor expanded in y around inf
Applied rewrites18.1%
Taylor expanded in z around 0
Applied rewrites18.1%
Final simplification40.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1e+44) (not (<= t 1.52e+29))) (- t) (* (- y) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1e+44) || !(t <= 1.52e+29)) {
tmp = -t;
} else {
tmp = -y * z;
}
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 <= (-1d+44)) .or. (.not. (t <= 1.52d+29))) then
tmp = -t
else
tmp = -y * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1e+44) || !(t <= 1.52e+29)) {
tmp = -t;
} else {
tmp = -y * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1e+44) or not (t <= 1.52e+29): tmp = -t else: tmp = -y * z return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1e+44) || !(t <= 1.52e+29)) tmp = Float64(-t); else tmp = Float64(Float64(-y) * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1e+44) || ~((t <= 1.52e+29))) tmp = -t; else tmp = -y * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1e+44], N[Not[LessEqual[t, 1.52e+29]], $MachinePrecision]], (-t), N[((-y) * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{+44} \lor \neg \left(t \leq 1.52 \cdot 10^{+29}\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;\left(-y\right) \cdot z\\
\end{array}
\end{array}
if t < -1.0000000000000001e44 or 1.52e29 < t Initial program 97.7%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6469.1
Applied rewrites69.1%
if -1.0000000000000001e44 < t < 1.52e29Initial program 83.6%
Taylor expanded in y around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower--.f64N/A
*-rgt-identityN/A
fp-cancel-sub-sign-invN/A
Applied rewrites98.8%
Taylor expanded in z around inf
Applied rewrites17.6%
Final simplification39.7%
(FPCore (x y z t) :precision binary64 (- t))
double code(double x, double y, double z, double t) {
return -t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -t
end function
public static double code(double x, double y, double z, double t) {
return -t;
}
def code(x, y, z, t): return -t
function code(x, y, z, t) return Float64(-t) end
function tmp = code(x, y, z, t) tmp = -t; end
code[x_, y_, z_, t_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 89.7%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6432.0
Applied rewrites32.0%
herbie shell --seed 2024326
(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))