
(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 19 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 (+ x -1.0) (log y) (* (log1p (- y)) (+ -1.0 z))) t))
double code(double x, double y, double z, double t) {
return fma((x + -1.0), log(y), (log1p(-y) * (-1.0 + z))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(x + -1.0), log(y), Float64(log1p(Float64(-y)) * Float64(-1.0 + z))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[Log[1 + (-y)], $MachinePrecision] * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x + -1, \log y, \mathsf{log1p}\left(-y\right) \cdot \left(-1 + z\right)\right) - t
\end{array}
Initial program 90.0%
fma-define90.0%
sub-neg90.0%
metadata-eval90.0%
sub-neg90.0%
metadata-eval90.0%
sub-neg90.0%
log1p-define99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ x -1.0)) (* z (log1p (- y)))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) + (z * log1p(-y))) - t;
}
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) + (z * Math.log1p(-y))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) + (z * math.log1p(-y))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(z * log1p(Float64(-y)))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) + z \cdot \mathsf{log1p}\left(-y\right)\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in z around inf 89.6%
*-commutative89.6%
sub-neg89.6%
log1p-define99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(-
(+
(* (log y) (+ x -1.0))
(*
(+ -1.0 z)
(* y (+ -1.0 (* y (- (* y (- (* y -0.25) 0.3333333333333333)) 0.5))))))
t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))))) - 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 = ((log(y) * (x + (-1.0d0))) + (((-1.0d0) + z) * (y * ((-1.0d0) + (y * ((y * ((y * (-0.25d0)) - 0.3333333333333333d0)) - 0.5d0)))))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(Float64(-1.0 + z) * Float64(y * Float64(-1.0 + Float64(y * Float64(Float64(y * Float64(Float64(y * -0.25) - 0.3333333333333333)) - 0.5)))))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + z), $MachinePrecision] * N[(y * N[(-1.0 + N[(y * N[(N[(y * N[(N[(y * -0.25), $MachinePrecision] - 0.3333333333333333), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \left(y \cdot \left(-1 + y \cdot \left(y \cdot \left(y \cdot -0.25 - 0.3333333333333333\right) - 0.5\right)\right)\right)\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in y around 0 99.3%
Final simplification99.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ x -1.0) -15500000000.0) (not (<= (+ x -1.0) 1.6e-77))) (- (* (log y) (+ x -1.0)) t) (- (- (- (log y)) (* y (+ -1.0 z))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x + -1.0) <= -15500000000.0) || !((x + -1.0) <= 1.6e-77)) {
tmp = (log(y) * (x + -1.0)) - t;
} else {
tmp = (-log(y) - (y * (-1.0 + z))) - 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)) <= (-15500000000.0d0)) .or. (.not. ((x + (-1.0d0)) <= 1.6d-77))) then
tmp = (log(y) * (x + (-1.0d0))) - t
else
tmp = (-log(y) - (y * ((-1.0d0) + z))) - 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) <= -15500000000.0) || !((x + -1.0) <= 1.6e-77)) {
tmp = (Math.log(y) * (x + -1.0)) - t;
} else {
tmp = (-Math.log(y) - (y * (-1.0 + z))) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x + -1.0) <= -15500000000.0) or not ((x + -1.0) <= 1.6e-77): tmp = (math.log(y) * (x + -1.0)) - t else: tmp = (-math.log(y) - (y * (-1.0 + z))) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x + -1.0) <= -15500000000.0) || !(Float64(x + -1.0) <= 1.6e-77)) tmp = Float64(Float64(log(y) * Float64(x + -1.0)) - t); else tmp = Float64(Float64(Float64(-log(y)) - Float64(y * Float64(-1.0 + z))) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x + -1.0) <= -15500000000.0) || ~(((x + -1.0) <= 1.6e-77))) tmp = (log(y) * (x + -1.0)) - t; else tmp = (-log(y) - (y * (-1.0 + z))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x + -1.0), $MachinePrecision], -15500000000.0], N[Not[LessEqual[N[(x + -1.0), $MachinePrecision], 1.6e-77]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[((-N[Log[y], $MachinePrecision]) - N[(y * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + -1 \leq -15500000000 \lor \neg \left(x + -1 \leq 1.6 \cdot 10^{-77}\right):\\
\;\;\;\;\log y \cdot \left(x + -1\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-\log y\right) - y \cdot \left(-1 + z\right)\right) - t\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -1.55e10 or 1.6e-77 < (-.f64 x #s(literal 1 binary64)) Initial program 94.1%
fma-define94.1%
sub-neg94.1%
metadata-eval94.1%
sub-neg94.1%
metadata-eval94.1%
sub-neg94.1%
log1p-define99.6%
Simplified99.6%
Taylor expanded in y around 0 92.3%
if -1.55e10 < (-.f64 x #s(literal 1 binary64)) < 1.6e-77Initial program 85.4%
Taylor expanded in y around 0 99.4%
Taylor expanded in x around 0 98.7%
mul-1-neg98.7%
Simplified98.7%
Taylor expanded in y around 0 98.6%
neg-mul-198.6%
Simplified98.6%
Final simplification95.3%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ x -1.0)) (* (+ -1.0 z) (* y (+ -1.0 (* y (- (* y -0.3333333333333333) 0.5)))))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))))) - 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 = ((log(y) * (x + (-1.0d0))) + (((-1.0d0) + z) * (y * ((-1.0d0) + (y * ((y * (-0.3333333333333333d0)) - 0.5d0)))))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(Float64(-1.0 + z) * Float64(y * Float64(-1.0 + Float64(y * Float64(Float64(y * -0.3333333333333333) - 0.5)))))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + z), $MachinePrecision] * N[(y * N[(-1.0 + N[(y * N[(N[(y * -0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \left(y \cdot \left(-1 + y \cdot \left(y \cdot -0.3333333333333333 - 0.5\right)\right)\right)\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in y around 0 99.3%
Final simplification99.3%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ x -1.0)) (* (+ -1.0 z) (* y (+ -1.0 (* y -0.5))))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) + ((-1.0 + z) * (y * (-1.0 + (y * -0.5))))) - 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 = ((log(y) * (x + (-1.0d0))) + (((-1.0d0) + z) * (y * ((-1.0d0) + (y * (-0.5d0)))))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) + ((-1.0 + z) * (y * (-1.0 + (y * -0.5))))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) + ((-1.0 + z) * (y * (-1.0 + (y * -0.5))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(Float64(-1.0 + z) * Float64(y * Float64(-1.0 + Float64(y * -0.5))))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) + ((-1.0 + z) * (y * (-1.0 + (y * -0.5))))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + z), $MachinePrecision] * N[(y * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right)\right)\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in y around 0 99.2%
Final simplification99.2%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ x -1.0)) (* z (* y (+ -1.0 (* y -0.5))))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) + (z * (y * (-1.0 + (y * -0.5))))) - 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 = ((log(y) * (x + (-1.0d0))) + (z * (y * ((-1.0d0) + (y * (-0.5d0)))))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) + (z * (y * (-1.0 + (y * -0.5))))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) + (z * (y * (-1.0 + (y * -0.5))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(z * Float64(y * Float64(-1.0 + Float64(y * -0.5))))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) + (z * (y * (-1.0 + (y * -0.5))))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(z * N[(y * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) + z \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right)\right)\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in y around 0 99.3%
Taylor expanded in y around 0 99.3%
*-commutative99.3%
Simplified99.3%
Taylor expanded in y around 0 99.2%
*-commutative99.2%
Simplified99.2%
Taylor expanded in z around inf 99.2%
Final simplification99.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.36e+121) (not (<= z 2.7e+196))) (- (* z (log1p (- y))) t) (- (- y (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.36e+121) || !(z <= 2.7e+196)) {
tmp = (z * log1p(-y)) - t;
} else {
tmp = (y - log(y)) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.36e+121) || !(z <= 2.7e+196)) {
tmp = (z * Math.log1p(-y)) - t;
} else {
tmp = (y - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.36e+121) or not (z <= 2.7e+196): tmp = (z * math.log1p(-y)) - t else: tmp = (y - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.36e+121) || !(z <= 2.7e+196)) tmp = Float64(Float64(z * log1p(Float64(-y))) - t); else tmp = Float64(Float64(y - log(y)) - t); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.36e+121], N[Not[LessEqual[z, 2.7e+196]], $MachinePrecision]], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.36 \cdot 10^{+121} \lor \neg \left(z \leq 2.7 \cdot 10^{+196}\right):\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(y - \log y\right) - t\\
\end{array}
\end{array}
if z < -1.36e121 or 2.69999999999999995e196 < z Initial program 64.9%
Taylor expanded in z around inf 64.9%
*-commutative64.9%
sub-neg64.9%
log1p-define99.8%
Simplified99.8%
Taylor expanded in z around inf 64.8%
sub-neg64.8%
log1p-undefine99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 22.2%
sub-neg22.2%
log1p-define55.3%
Simplified55.3%
if -1.36e121 < z < 2.69999999999999995e196Initial program 98.7%
Taylor expanded in y around 0 99.4%
Taylor expanded in x around 0 59.7%
mul-1-neg59.7%
Simplified59.7%
Taylor expanded in z around 0 58.5%
Taylor expanded in y around 0 58.5%
Final simplification57.7%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -3.85e+121) (not (<= z 1.6e+196)))
(-
(* z (* y (+ -1.0 (* y (- (* y (- (* y -0.25) 0.3333333333333333)) 0.5)))))
t)
(- (- y (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.85e+121) || !(z <= 1.6e+196)) {
tmp = (z * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5))))) - 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 ((z <= (-3.85d+121)) .or. (.not. (z <= 1.6d+196))) then
tmp = (z * (y * ((-1.0d0) + (y * ((y * ((y * (-0.25d0)) - 0.3333333333333333d0)) - 0.5d0))))) - 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 ((z <= -3.85e+121) || !(z <= 1.6e+196)) {
tmp = (z * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5))))) - t;
} else {
tmp = (y - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.85e+121) or not (z <= 1.6e+196): tmp = (z * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5))))) - t else: tmp = (y - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.85e+121) || !(z <= 1.6e+196)) tmp = Float64(Float64(z * Float64(y * Float64(-1.0 + Float64(y * Float64(Float64(y * Float64(Float64(y * -0.25) - 0.3333333333333333)) - 0.5))))) - 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 ((z <= -3.85e+121) || ~((z <= 1.6e+196))) tmp = (z * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5))))) - t; else tmp = (y - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.85e+121], N[Not[LessEqual[z, 1.6e+196]], $MachinePrecision]], N[(N[(z * N[(y * N[(-1.0 + N[(y * N[(N[(y * N[(N[(y * -0.25), $MachinePrecision] - 0.3333333333333333), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.85 \cdot 10^{+121} \lor \neg \left(z \leq 1.6 \cdot 10^{+196}\right):\\
\;\;\;\;z \cdot \left(y \cdot \left(-1 + y \cdot \left(y \cdot \left(y \cdot -0.25 - 0.3333333333333333\right) - 0.5\right)\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(y - \log y\right) - t\\
\end{array}
\end{array}
if z < -3.85000000000000014e121 or 1.59999999999999996e196 < z Initial program 64.9%
Taylor expanded in z around inf 64.9%
*-commutative64.9%
sub-neg64.9%
log1p-define99.8%
Simplified99.8%
Taylor expanded in z around inf 64.8%
sub-neg64.8%
log1p-undefine99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 22.2%
Taylor expanded in y around 0 54.6%
if -3.85000000000000014e121 < z < 1.59999999999999996e196Initial program 98.7%
Taylor expanded in y around 0 99.4%
Taylor expanded in x around 0 59.7%
mul-1-neg59.7%
Simplified59.7%
Taylor expanded in z around 0 58.5%
Taylor expanded in y around 0 58.5%
Final simplification57.5%
(FPCore (x y z t) :precision binary64 (- (- (* (log y) (+ x -1.0)) (* y (+ -1.0 z))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) - (y * (-1.0 + 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 = ((log(y) * (x + (-1.0d0))) - (y * ((-1.0d0) + z))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) - (y * (-1.0 + z))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) - (y * (-1.0 + z))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) - Float64(y * Float64(-1.0 + z))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) - (y * (-1.0 + z))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - N[(y * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) - y \cdot \left(-1 + z\right)\right) - t
\end{array}
Initial program 90.0%
add-cbrt-cube89.6%
pow389.6%
Applied egg-rr89.6%
Taylor expanded in y around 0 98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
mul-1-neg98.9%
unsub-neg98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x y z t) :precision binary64 (if (<= z -1.1e+261) (- (* z (* y (+ -1.0 (* y -0.5)))) t) (- (* (log y) (+ x -1.0)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.1e+261) {
tmp = (z * (y * (-1.0 + (y * -0.5)))) - t;
} else {
tmp = (log(y) * (x + -1.0)) - 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.1d+261)) then
tmp = (z * (y * ((-1.0d0) + (y * (-0.5d0))))) - t
else
tmp = (log(y) * (x + (-1.0d0))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.1e+261) {
tmp = (z * (y * (-1.0 + (y * -0.5)))) - t;
} else {
tmp = (Math.log(y) * (x + -1.0)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.1e+261: tmp = (z * (y * (-1.0 + (y * -0.5)))) - t else: tmp = (math.log(y) * (x + -1.0)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.1e+261) tmp = Float64(Float64(z * Float64(y * Float64(-1.0 + Float64(y * -0.5)))) - t); else tmp = Float64(Float64(log(y) * Float64(x + -1.0)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.1e+261) tmp = (z * (y * (-1.0 + (y * -0.5)))) - t; else tmp = (log(y) * (x + -1.0)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.1e+261], N[(N[(z * N[(y * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{+261}:\\
\;\;\;\;z \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(x + -1\right) - t\\
\end{array}
\end{array}
if z < -1.09999999999999992e261Initial program 34.9%
Taylor expanded in z around inf 34.9%
*-commutative34.9%
sub-neg34.9%
log1p-define99.9%
Simplified99.9%
Taylor expanded in z around inf 34.9%
sub-neg34.9%
log1p-undefine100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in z around inf 25.3%
Taylor expanded in y around 0 87.0%
if -1.09999999999999992e261 < z Initial program 92.4%
fma-define92.4%
sub-neg92.4%
metadata-eval92.4%
sub-neg92.4%
metadata-eval92.4%
sub-neg92.4%
log1p-define99.8%
Simplified99.8%
Taylor expanded in y around 0 91.4%
Final simplification91.2%
(FPCore (x y z t) :precision binary64 (- (- (* (log y) (+ x -1.0)) (* y z)) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) - (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 = ((log(y) * (x + (-1.0d0))) - (y * z)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) - (y * z)) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) - (y * z)) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) - Float64(y * z)) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) - (y * z)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) - y \cdot z\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in z around inf 89.6%
*-commutative89.6%
sub-neg89.6%
log1p-define99.5%
Simplified99.5%
Taylor expanded in y around 0 98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
mul-1-neg98.9%
unsub-neg98.9%
+-commutative98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x y z t) :precision binary64 (- (* z (* y (+ -1.0 (* y (- (* y (- (* y -0.25) 0.3333333333333333)) 0.5))))) t))
double code(double x, double y, double z, double t) {
return (z * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5))))) - 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 = (z * (y * ((-1.0d0) + (y * ((y * ((y * (-0.25d0)) - 0.3333333333333333d0)) - 0.5d0))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (z * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5))))) - t;
}
def code(x, y, z, t): return (z * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5))))) - t
function code(x, y, z, t) return Float64(Float64(z * Float64(y * Float64(-1.0 + Float64(y * Float64(Float64(y * Float64(Float64(y * -0.25) - 0.3333333333333333)) - 0.5))))) - t) end
function tmp = code(x, y, z, t) tmp = (z * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5))))) - t; end
code[x_, y_, z_, t_] := N[(N[(z * N[(y * N[(-1.0 + N[(y * N[(N[(y * N[(N[(y * -0.25), $MachinePrecision] - 0.3333333333333333), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(y \cdot \left(-1 + y \cdot \left(y \cdot \left(y \cdot -0.25 - 0.3333333333333333\right) - 0.5\right)\right)\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in z around inf 89.6%
*-commutative89.6%
sub-neg89.6%
log1p-define99.5%
Simplified99.5%
Taylor expanded in z around inf 77.2%
sub-neg77.2%
log1p-undefine87.1%
sub-neg87.1%
metadata-eval87.1%
+-commutative87.1%
Simplified87.1%
Taylor expanded in z around inf 31.7%
Taylor expanded in y around 0 40.6%
Final simplification40.6%
(FPCore (x y z t) :precision binary64 (- (* y (* z (+ -1.0 (* y (- (* y (- (* y -0.25) 0.3333333333333333)) 0.5))))) t))
double code(double x, double y, double z, double t) {
return (y * (z * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5))))) - 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 * ((-1.0d0) + (y * ((y * ((y * (-0.25d0)) - 0.3333333333333333d0)) - 0.5d0))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * (z * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5))))) - t;
}
def code(x, y, z, t): return (y * (z * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5))))) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(z * Float64(-1.0 + Float64(y * Float64(Float64(y * Float64(Float64(y * -0.25) - 0.3333333333333333)) - 0.5))))) - t) end
function tmp = code(x, y, z, t) tmp = (y * (z * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5))))) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(z * N[(-1.0 + N[(y * N[(N[(y * N[(N[(y * -0.25), $MachinePrecision] - 0.3333333333333333), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(z \cdot \left(-1 + y \cdot \left(y \cdot \left(y \cdot -0.25 - 0.3333333333333333\right) - 0.5\right)\right)\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in y around 0 99.3%
Taylor expanded in z around inf 40.6%
Final simplification40.6%
(FPCore (x y z t) :precision binary64 (- (* z (* y (+ -1.0 (* y (- (* y -0.3333333333333333) 0.5))))) t))
double code(double x, double y, double z, double t) {
return (z * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - 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 = (z * (y * ((-1.0d0) + (y * ((y * (-0.3333333333333333d0)) - 0.5d0))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (z * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t;
}
def code(x, y, z, t): return (z * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t
function code(x, y, z, t) return Float64(Float64(z * Float64(y * Float64(-1.0 + Float64(y * Float64(Float64(y * -0.3333333333333333) - 0.5))))) - t) end
function tmp = code(x, y, z, t) tmp = (z * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t; end
code[x_, y_, z_, t_] := N[(N[(z * N[(y * N[(-1.0 + N[(y * N[(N[(y * -0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(y \cdot \left(-1 + y \cdot \left(y \cdot -0.3333333333333333 - 0.5\right)\right)\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in z around inf 89.6%
*-commutative89.6%
sub-neg89.6%
log1p-define99.5%
Simplified99.5%
Taylor expanded in z around inf 77.2%
sub-neg77.2%
log1p-undefine87.1%
sub-neg87.1%
metadata-eval87.1%
+-commutative87.1%
Simplified87.1%
Taylor expanded in z around inf 31.7%
Taylor expanded in y around 0 40.6%
Final simplification40.6%
(FPCore (x y z t) :precision binary64 (- (* z (* y (+ -1.0 (* y -0.5)))) t))
double code(double x, double y, double z, double t) {
return (z * (y * (-1.0 + (y * -0.5)))) - 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 = (z * (y * ((-1.0d0) + (y * (-0.5d0))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (z * (y * (-1.0 + (y * -0.5)))) - t;
}
def code(x, y, z, t): return (z * (y * (-1.0 + (y * -0.5)))) - t
function code(x, y, z, t) return Float64(Float64(z * Float64(y * Float64(-1.0 + Float64(y * -0.5)))) - t) end
function tmp = code(x, y, z, t) tmp = (z * (y * (-1.0 + (y * -0.5)))) - t; end
code[x_, y_, z_, t_] := N[(N[(z * N[(y * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right)\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in z around inf 89.6%
*-commutative89.6%
sub-neg89.6%
log1p-define99.5%
Simplified99.5%
Taylor expanded in z around inf 77.2%
sub-neg77.2%
log1p-undefine87.1%
sub-neg87.1%
metadata-eval87.1%
+-commutative87.1%
Simplified87.1%
Taylor expanded in z around inf 31.7%
Taylor expanded in y around 0 40.6%
Final simplification40.6%
(FPCore (x y z t) :precision binary64 (- (- t) (* y z)))
double code(double x, double y, double z, double t) {
return -t - (y * z);
}
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 - (y * z)
end function
public static double code(double x, double y, double z, double t) {
return -t - (y * z);
}
def code(x, y, z, t): return -t - (y * z)
function code(x, y, z, t) return Float64(Float64(-t) - Float64(y * z)) end
function tmp = code(x, y, z, t) tmp = -t - (y * z); end
code[x_, y_, z_, t_] := N[((-t) - N[(y * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-t\right) - y \cdot z
\end{array}
Initial program 90.0%
Taylor expanded in z around inf 89.6%
*-commutative89.6%
sub-neg89.6%
log1p-define99.5%
Simplified99.5%
Taylor expanded in z around inf 77.2%
sub-neg77.2%
log1p-undefine87.1%
sub-neg87.1%
metadata-eval87.1%
+-commutative87.1%
Simplified87.1%
Taylor expanded in z around inf 31.7%
Taylor expanded in y around 0 40.5%
associate-*r*40.5%
neg-mul-140.5%
Simplified40.5%
Final simplification40.5%
(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%
fma-define90.0%
sub-neg90.0%
metadata-eval90.0%
sub-neg90.0%
metadata-eval90.0%
sub-neg90.0%
log1p-define99.8%
Simplified99.8%
Taylor expanded in t around inf 30.9%
neg-mul-130.9%
Simplified30.9%
(FPCore (x y z t) :precision binary64 0.0)
double code(double x, double y, double z, double t) {
return 0.0;
}
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.0d0
end function
public static double code(double x, double y, double z, double t) {
return 0.0;
}
def code(x, y, z, t): return 0.0
function code(x, y, z, t) return 0.0 end
function tmp = code(x, y, z, t) tmp = 0.0; end
code[x_, y_, z_, t_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 90.0%
fma-define90.0%
sub-neg90.0%
metadata-eval90.0%
sub-neg90.0%
metadata-eval90.0%
sub-neg90.0%
log1p-define99.8%
Simplified99.8%
Taylor expanded in t around inf 30.9%
neg-mul-130.9%
Simplified30.9%
expm1-log1p-u13.8%
expm1-undefine13.6%
Applied egg-rr13.6%
sub-neg13.6%
log1p-undefine13.6%
rem-exp-log30.6%
unsub-neg30.6%
metadata-eval30.6%
Simplified30.6%
Taylor expanded in t around 0 2.3%
metadata-eval2.3%
Applied egg-rr2.3%
herbie shell --seed 2024185
(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))