
(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 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
(FPCore (x y z t)
:precision binary64
(-
(+
(*
(* (fma (fma (fma -0.25 y -0.3333333333333333) y -0.5) y -1.0) y)
(- z 1.0))
(* (log y) (- x 1.0)))
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 - 1.0)) + (log(y) * (x - 1.0))) - t;
}
function code(x, y, z, t) return Float64(Float64(Float64(Float64(fma(fma(fma(-0.25, y, -0.3333333333333333), y, -0.5), y, -1.0) * y) * Float64(z - 1.0)) + Float64(log(y) * Float64(x - 1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(N[(N[(-0.25 * y + -0.3333333333333333), $MachinePrecision] * y + -0.5), $MachinePrecision] * y + -1.0), $MachinePrecision] * y), $MachinePrecision] * N[(z - 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\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 \left(z - 1\right) + \log y \cdot \left(x - 1\right)\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f6499.8
Applied rewrites99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (+ (* (* (fma (fma -0.3333333333333333 y -0.5) y -1.0) y) (- z 1.0)) (* (log y) (- x 1.0))) t))
double code(double x, double y, double z, double t) {
return (((fma(fma(-0.3333333333333333, y, -0.5), y, -1.0) * y) * (z - 1.0)) + (log(y) * (x - 1.0))) - t;
}
function code(x, y, z, t) return Float64(Float64(Float64(Float64(fma(fma(-0.3333333333333333, y, -0.5), y, -1.0) * y) * Float64(z - 1.0)) + Float64(log(y) * Float64(x - 1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(N[(-0.3333333333333333 * y + -0.5), $MachinePrecision] * y + -1.0), $MachinePrecision] * y), $MachinePrecision] * N[(z - 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.3333333333333333, y, -0.5\right), y, -1\right) \cdot y\right) \cdot \left(z - 1\right) + \log y \cdot \left(x - 1\right)\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f6499.7
Applied rewrites99.7%
Final simplification99.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (- x 1.0) (log y) (- t))))
(if (<= (- x 1.0) -100000.0)
t_1
(if (<= (- x 1.0) -1.0) (- (fma (- 1.0 z) y (- (log y))) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((x - 1.0), log(y), -t);
double tmp;
if ((x - 1.0) <= -100000.0) {
tmp = t_1;
} else if ((x - 1.0) <= -1.0) {
tmp = fma((1.0 - z), y, -log(y)) - t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(x - 1.0), log(y), Float64(-t)) tmp = 0.0 if (Float64(x - 1.0) <= -100000.0) tmp = t_1; elseif (Float64(x - 1.0) <= -1.0) 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[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + (-t)), $MachinePrecision]}, If[LessEqual[N[(x - 1.0), $MachinePrecision], -100000.0], t$95$1, If[LessEqual[N[(x - 1.0), $MachinePrecision], -1.0], 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 := \mathsf{fma}\left(x - 1, \log y, -t\right)\\
\mathbf{if}\;x - 1 \leq -100000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x - 1 \leq -1:\\
\;\;\;\;\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)) < -1e5 or -1 < (-.f64 x #s(literal 1 binary64)) Initial program 94.0%
Taylor expanded in y around 0
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f6494.0
Applied rewrites94.0%
if -1e5 < (-.f64 x #s(literal 1 binary64)) < -1Initial program 86.1%
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.f6498.9
Applied rewrites98.9%
Taylor expanded in x around 0
Applied rewrites98.9%
(FPCore (x y z t) :precision binary64 (- (fma (* (fma -0.5 y -1.0) (- z 1.0)) y (* (log y) (- x 1.0))) t))
double code(double x, double y, double z, double t) {
return fma((fma(-0.5, y, -1.0) * (z - 1.0)), y, (log(y) * (x - 1.0))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(fma(-0.5, y, -1.0) * Float64(z - 1.0)), y, Float64(log(y) * Float64(x - 1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(-0.5 * y + -1.0), $MachinePrecision] * N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * y + N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(-0.5, y, -1\right) \cdot \left(z - 1\right), y, \log y \cdot \left(x - 1\right)\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
distribute-rgt-outN/A
+-commutativeN/A
metadata-evalN/A
sub-negN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower--.f6499.5
Applied rewrites99.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (- (fma (* (- z 1.0) y) (fma -0.5 y -1.0) (* (log y) (- x 1.0))) t))
double code(double x, double y, double z, double t) {
return fma(((z - 1.0) * y), fma(-0.5, y, -1.0), (log(y) * (x - 1.0))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(Float64(z - 1.0) * y), fma(-0.5, y, -1.0), Float64(log(y) * Float64(x - 1.0))) - 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[Log[y], $MachinePrecision] * N[(x - 1.0), $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), \log y \cdot \left(x - 1\right)\right) - t
\end{array}
Initial program 90.0%
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.5
Applied rewrites99.5%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* (log y) x) t)))
(if (<= (- x 1.0) -100000.0)
t_1
(if (<= (- x 1.0) -1.0) (- (- y (log y)) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (log(y) * x) - t;
double tmp;
if ((x - 1.0) <= -100000.0) {
tmp = t_1;
} else if ((x - 1.0) <= -1.0) {
tmp = (y - 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 = (log(y) * x) - t
if ((x - 1.0d0) <= (-100000.0d0)) then
tmp = t_1
else if ((x - 1.0d0) <= (-1.0d0)) then
tmp = (y - 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 = (Math.log(y) * x) - t;
double tmp;
if ((x - 1.0) <= -100000.0) {
tmp = t_1;
} else if ((x - 1.0) <= -1.0) {
tmp = (y - Math.log(y)) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (math.log(y) * x) - t tmp = 0 if (x - 1.0) <= -100000.0: tmp = t_1 elif (x - 1.0) <= -1.0: tmp = (y - math.log(y)) - t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(log(y) * x) - t) tmp = 0.0 if (Float64(x - 1.0) <= -100000.0) tmp = t_1; elseif (Float64(x - 1.0) <= -1.0) tmp = Float64(Float64(y - log(y)) - t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (log(y) * x) - t; tmp = 0.0; if ((x - 1.0) <= -100000.0) tmp = t_1; elseif ((x - 1.0) <= -1.0) tmp = (y - log(y)) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[N[(x - 1.0), $MachinePrecision], -100000.0], t$95$1, If[LessEqual[N[(x - 1.0), $MachinePrecision], -1.0], N[(N[(y - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x - t\\
\mathbf{if}\;x - 1 \leq -100000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x - 1 \leq -1:\\
\;\;\;\;\left(y - \log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -1e5 or -1 < (-.f64 x #s(literal 1 binary64)) Initial program 94.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6492.8
Applied rewrites92.8%
if -1e5 < (-.f64 x #s(literal 1 binary64)) < -1Initial program 86.1%
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.f6498.9
Applied rewrites98.9%
Taylor expanded in z around 0
Applied rewrites84.8%
Taylor expanded in x around 0
Applied rewrites84.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x)))
(if (<= (- x 1.0) -100000.0)
t_1
(if (<= (- x 1.0) 2e+118) (- (- y (log 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.0) <= -100000.0) {
tmp = t_1;
} else if ((x - 1.0) <= 2e+118) {
tmp = (y - 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 = log(y) * x
if ((x - 1.0d0) <= (-100000.0d0)) then
tmp = t_1
else if ((x - 1.0d0) <= 2d+118) then
tmp = (y - 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 = Math.log(y) * x;
double tmp;
if ((x - 1.0) <= -100000.0) {
tmp = t_1;
} else if ((x - 1.0) <= 2e+118) {
tmp = (y - Math.log(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.0) <= -100000.0: tmp = t_1 elif (x - 1.0) <= 2e+118: tmp = (y - math.log(y)) - t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * x) tmp = 0.0 if (Float64(x - 1.0) <= -100000.0) tmp = t_1; elseif (Float64(x - 1.0) <= 2e+118) tmp = Float64(Float64(y - log(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.0) <= -100000.0) tmp = t_1; elseif ((x - 1.0) <= 2e+118) tmp = (y - log(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[N[(x - 1.0), $MachinePrecision], -100000.0], t$95$1, If[LessEqual[N[(x - 1.0), $MachinePrecision], 2e+118], N[(N[(y - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x - 1 \leq -100000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x - 1 \leq 2 \cdot 10^{+118}:\\
\;\;\;\;\left(y - \log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -1e5 or 1.99999999999999993e118 < (-.f64 x #s(literal 1 binary64)) Initial program 94.3%
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.f6471.4
Applied rewrites71.4%
if -1e5 < (-.f64 x #s(literal 1 binary64)) < 1.99999999999999993e118Initial program 87.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.0
Applied rewrites99.0%
Taylor expanded in z around 0
Applied rewrites86.1%
Taylor expanded in x around 0
Applied rewrites78.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x)))
(if (<= (- x 1.0) -100000.0)
t_1
(if (<= (- x 1.0) 2e+118) (- (+ t (log y))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double tmp;
if ((x - 1.0) <= -100000.0) {
tmp = t_1;
} else if ((x - 1.0) <= 2e+118) {
tmp = -(t + log(y));
} 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.0d0) <= (-100000.0d0)) then
tmp = t_1
else if ((x - 1.0d0) <= 2d+118) then
tmp = -(t + log(y))
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.0) <= -100000.0) {
tmp = t_1;
} else if ((x - 1.0) <= 2e+118) {
tmp = -(t + Math.log(y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * x tmp = 0 if (x - 1.0) <= -100000.0: tmp = t_1 elif (x - 1.0) <= 2e+118: tmp = -(t + math.log(y)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * x) tmp = 0.0 if (Float64(x - 1.0) <= -100000.0) tmp = t_1; elseif (Float64(x - 1.0) <= 2e+118) tmp = Float64(-Float64(t + log(y))); 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.0) <= -100000.0) tmp = t_1; elseif ((x - 1.0) <= 2e+118) tmp = -(t + log(y)); 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[N[(x - 1.0), $MachinePrecision], -100000.0], t$95$1, If[LessEqual[N[(x - 1.0), $MachinePrecision], 2e+118], (-N[(t + N[Log[y], $MachinePrecision]), $MachinePrecision]), t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x - 1 \leq -100000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x - 1 \leq 2 \cdot 10^{+118}:\\
\;\;\;\;-\left(t + \log y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -1e5 or 1.99999999999999993e118 < (-.f64 x #s(literal 1 binary64)) Initial program 94.3%
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.f6471.4
Applied rewrites71.4%
if -1e5 < (-.f64 x #s(literal 1 binary64)) < 1.99999999999999993e118Initial program 87.2%
Taylor expanded in y around 0
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f6485.7
Applied rewrites85.7%
Taylor expanded in x around 0
Applied rewrites78.0%
Final simplification75.4%
(FPCore (x y z t) :precision binary64 (if (<= (- z 1.0) 2e+243) (- (fma (log y) (- x 1.0) y) t) (- (* (- y) z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z - 1.0) <= 2e+243) {
tmp = fma(log(y), (x - 1.0), y) - t;
} else {
tmp = (-y * z) - t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z - 1.0) <= 2e+243) tmp = Float64(fma(log(y), Float64(x - 1.0), y) - t); else tmp = Float64(Float64(Float64(-y) * z) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z - 1.0), $MachinePrecision], 2e+243], N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision] + y), $MachinePrecision] - t), $MachinePrecision], N[(N[((-y) * z), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z - 1 \leq 2 \cdot 10^{+243}:\\
\;\;\;\;\mathsf{fma}\left(\log y, x - 1, y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-y\right) \cdot z - t\\
\end{array}
\end{array}
if (-.f64 z #s(literal 1 binary64)) < 2.0000000000000001e243Initial program 93.1%
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.2
Applied rewrites99.2%
Taylor expanded in z around 0
Applied rewrites92.4%
if 2.0000000000000001e243 < (-.f64 z #s(literal 1 binary64)) Initial program 32.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.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites84.7%
(FPCore (x y z t) :precision binary64 (if (<= (- z 1.0) 2e+243) (fma (- x 1.0) (log y) (- t)) (- (* (- y) z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z - 1.0) <= 2e+243) {
tmp = fma((x - 1.0), log(y), -t);
} else {
tmp = (-y * z) - t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z - 1.0) <= 2e+243) tmp = fma(Float64(x - 1.0), log(y), Float64(-t)); else tmp = Float64(Float64(Float64(-y) * z) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z - 1.0), $MachinePrecision], 2e+243], N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + (-t)), $MachinePrecision], N[(N[((-y) * z), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z - 1 \leq 2 \cdot 10^{+243}:\\
\;\;\;\;\mathsf{fma}\left(x - 1, \log y, -t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-y\right) \cdot z - t\\
\end{array}
\end{array}
if (-.f64 z #s(literal 1 binary64)) < 2.0000000000000001e243Initial program 93.1%
Taylor expanded in y around 0
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f6492.2
Applied rewrites92.2%
if 2.0000000000000001e243 < (-.f64 z #s(literal 1 binary64)) Initial program 32.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.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites84.7%
(FPCore (x y z t) :precision binary64 (- (fma (- 1.0 z) y (* (log y) (- x 1.0))) t))
double code(double x, double y, double z, double t) {
return fma((1.0 - z), y, (log(y) * (x - 1.0))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(1.0 - z), y, Float64(log(y) * Float64(x - 1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(1.0 - z), $MachinePrecision] * y + N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(1 - z, y, \log y \cdot \left(x - 1\right)\right) - t
\end{array}
Initial program 90.0%
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.3
Applied rewrites99.3%
Final simplification99.3%
(FPCore (x y z t) :precision binary64 (- (fma (- z) y (* (log y) (- x 1.0))) t))
double code(double x, double y, double z, double t) {
return fma(-z, y, (log(y) * (x - 1.0))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(-z), y, Float64(log(y) * Float64(x - 1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[((-z) * y + N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-z, y, \log y \cdot \left(x - 1\right)\right) - t
\end{array}
Initial program 90.0%
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.3
Applied rewrites99.3%
Taylor expanded in z around inf
Applied rewrites99.0%
Final simplification99.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (* (- y) z) t))) (if (<= z -3e+88) t_1 (if (<= z 1.3e+67) (- (+ t (log y))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (-y * z) - t;
double tmp;
if (z <= -3e+88) {
tmp = t_1;
} else if (z <= 1.3e+67) {
tmp = -(t + log(y));
} 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 = (-y * z) - t
if (z <= (-3d+88)) then
tmp = t_1
else if (z <= 1.3d+67) then
tmp = -(t + log(y))
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 = (-y * z) - t;
double tmp;
if (z <= -3e+88) {
tmp = t_1;
} else if (z <= 1.3e+67) {
tmp = -(t + Math.log(y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (-y * z) - t tmp = 0 if z <= -3e+88: tmp = t_1 elif z <= 1.3e+67: tmp = -(t + math.log(y)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(-y) * z) - t) tmp = 0.0 if (z <= -3e+88) tmp = t_1; elseif (z <= 1.3e+67) tmp = Float64(-Float64(t + log(y))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (-y * z) - t; tmp = 0.0; if (z <= -3e+88) tmp = t_1; elseif (z <= 1.3e+67) tmp = -(t + log(y)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[((-y) * z), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[z, -3e+88], t$95$1, If[LessEqual[z, 1.3e+67], (-N[(t + N[Log[y], $MachinePrecision]), $MachinePrecision]), t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-y\right) \cdot z - t\\
\mathbf{if}\;z \leq -3 \cdot 10^{+88}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+67}:\\
\;\;\;\;-\left(t + \log y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.00000000000000005e88 or 1.3e67 < z Initial program 72.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.0
Applied rewrites99.0%
Taylor expanded in z around inf
Applied rewrites54.9%
if -3.00000000000000005e88 < z < 1.3e67Initial program 99.7%
Taylor expanded in y around 0
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f6498.9
Applied rewrites98.9%
Taylor expanded in x around 0
Applied rewrites68.0%
Final simplification63.4%
(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 90.0%
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.3
Applied rewrites99.3%
Taylor expanded in y around inf
Applied rewrites47.0%
(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 90.0%
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.3
Applied rewrites99.3%
Taylor expanded in z around inf
Applied rewrites46.8%
(FPCore (x y z t) :precision binary64 (- (* 1.0 y) t))
double code(double x, double y, double z, double t) {
return (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 = (1.0d0 * y) - t
end function
public static double code(double x, double y, double z, double t) {
return (1.0 * y) - t;
}
def code(x, y, z, t): return (1.0 * y) - t
function code(x, y, z, t) return Float64(Float64(1.0 * y) - t) end
function tmp = code(x, y, z, t) tmp = (1.0 * y) - t; end
code[x_, y_, z_, t_] := N[(N[(1.0 * y), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot y - t
\end{array}
Initial program 90.0%
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.3
Applied rewrites99.3%
Taylor expanded in y around inf
Applied rewrites47.0%
Taylor expanded in z around 0
Applied rewrites38.2%
(FPCore (x y z t) :precision binary64 (- t))
double code(double x, double y, double z, double t) {
return -t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -t
end function
public static double code(double x, double y, double z, double t) {
return -t;
}
def code(x, y, z, t): return -t
function code(x, y, z, t) return Float64(-t) end
function tmp = code(x, y, z, t) tmp = -t; end
code[x_, y_, z_, t_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 90.0%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6437.8
Applied rewrites37.8%
herbie shell --seed 2024294
(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))