
(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 (- (fma (+ z -1.0) (log1p (- y)) (* (log y) (+ -1.0 x))) t))
double code(double x, double y, double z, double t) {
return fma((z + -1.0), log1p(-y), (log(y) * (-1.0 + x))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(z + -1.0), log1p(Float64(-y)), Float64(log(y) * Float64(-1.0 + x))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Initial program 88.9%
+-commutative88.9%
fma-define88.9%
sub-neg88.9%
metadata-eval88.9%
sub-neg88.9%
log1p-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(-
(+
(*
(* y (+ -1.0 (* y (- (* y (- (* y -0.25) 0.3333333333333333)) 0.5))))
(+ z -1.0))
(* (log y) (+ -1.0 x)))
t))
double code(double x, double y, double z, double t) {
return (((y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))) * (z + -1.0)) + (log(y) * (-1.0 + x))) - 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 * ((-1.0d0) + (y * ((y * ((y * (-0.25d0)) - 0.3333333333333333d0)) - 0.5d0)))) * (z + (-1.0d0))) + (log(y) * ((-1.0d0) + x))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))) * (z + -1.0)) + (Math.log(y) * (-1.0 + x))) - t;
}
def code(x, y, z, t): return (((y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))) * (z + -1.0)) + (math.log(y) * (-1.0 + x))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(y * Float64(-1.0 + Float64(y * Float64(Float64(y * Float64(Float64(y * -0.25) - 0.3333333333333333)) - 0.5)))) * Float64(z + -1.0)) + Float64(log(y) * Float64(-1.0 + x))) - t) end
function tmp = code(x, y, z, t) tmp = (((y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))) * (z + -1.0)) + (log(y) * (-1.0 + x))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(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] * N[(z + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(y \cdot \left(-1 + y \cdot \left(y \cdot \left(y \cdot -0.25 - 0.3333333333333333\right) - 0.5\right)\right)\right) \cdot \left(z + -1\right) + \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Initial program 88.9%
Taylor expanded in y around 0 99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ -1.0 x) -1.0) (not (<= (+ -1.0 x) 1e+27))) (- (* (log y) (+ -1.0 x)) t) (- (- (* y (- 1.0 z)) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -1.0) || !((-1.0 + x) <= 1e+27)) {
tmp = (log(y) * (-1.0 + x)) - t;
} else {
tmp = ((y * (1.0 - z)) - 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 ((((-1.0d0) + x) <= (-1.0d0)) .or. (.not. (((-1.0d0) + x) <= 1d+27))) then
tmp = (log(y) * ((-1.0d0) + x)) - t
else
tmp = ((y * (1.0d0 - z)) - log(y)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -1.0) || !((-1.0 + x) <= 1e+27)) {
tmp = (Math.log(y) * (-1.0 + x)) - t;
} else {
tmp = ((y * (1.0 - z)) - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((-1.0 + x) <= -1.0) or not ((-1.0 + x) <= 1e+27): tmp = (math.log(y) * (-1.0 + x)) - t else: tmp = ((y * (1.0 - z)) - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(-1.0 + x) <= -1.0) || !(Float64(-1.0 + x) <= 1e+27)) tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); else tmp = Float64(Float64(Float64(y * Float64(1.0 - z)) - log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((-1.0 + x) <= -1.0) || ~(((-1.0 + x) <= 1e+27))) tmp = (log(y) * (-1.0 + x)) - t; else tmp = ((y * (1.0 - z)) - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(-1.0 + x), $MachinePrecision], -1.0], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], 1e+27]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -1 \lor \neg \left(-1 + x \leq 10^{+27}\right):\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot \left(1 - z\right) - \log y\right) - t\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -1 or 1e27 < (-.f64 x #s(literal 1 binary64)) Initial program 89.3%
+-commutative89.3%
fma-define89.3%
sub-neg89.3%
metadata-eval89.3%
sub-neg89.3%
log1p-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 88.0%
if -1 < (-.f64 x #s(literal 1 binary64)) < 1e27Initial program 77.1%
flip--77.1%
metadata-eval77.1%
metadata-eval77.1%
associate-*l/77.1%
metadata-eval77.1%
fma-neg77.1%
metadata-eval77.1%
+-commutative77.1%
Applied egg-rr77.1%
Taylor expanded in x around 0 56.2%
+-commutative56.2%
mul-1-neg56.2%
sub-neg56.2%
*-commutative56.2%
sub-neg56.2%
log1p-undefine79.9%
sub-neg79.9%
metadata-eval79.9%
+-commutative79.9%
Simplified79.9%
Taylor expanded in y around 0 79.9%
sub-neg79.9%
metadata-eval79.9%
+-commutative79.9%
neg-mul-179.9%
distribute-rgt-neg-in79.9%
distribute-neg-in79.9%
metadata-eval79.9%
sub-neg79.9%
Simplified79.9%
Final simplification87.7%
(FPCore (x y z t) :precision binary64 (- (+ (* (* y (+ -1.0 (* y (- (* y -0.3333333333333333) 0.5)))) (+ z -1.0)) (* (log y) (+ -1.0 x))) t))
double code(double x, double y, double z, double t) {
return (((y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))) * (z + -1.0)) + (log(y) * (-1.0 + x))) - 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 * ((-1.0d0) + (y * ((y * (-0.3333333333333333d0)) - 0.5d0)))) * (z + (-1.0d0))) + (log(y) * ((-1.0d0) + x))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))) * (z + -1.0)) + (Math.log(y) * (-1.0 + x))) - t;
}
def code(x, y, z, t): return (((y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))) * (z + -1.0)) + (math.log(y) * (-1.0 + x))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(y * Float64(-1.0 + Float64(y * Float64(Float64(y * -0.3333333333333333) - 0.5)))) * Float64(z + -1.0)) + Float64(log(y) * Float64(-1.0 + x))) - t) end
function tmp = code(x, y, z, t) tmp = (((y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))) * (z + -1.0)) + (log(y) * (-1.0 + x))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(y * N[(-1.0 + N[(y * N[(N[(y * -0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(z + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(y \cdot \left(-1 + y \cdot \left(y \cdot -0.3333333333333333 - 0.5\right)\right)\right) \cdot \left(z + -1\right) + \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Initial program 88.9%
Taylor expanded in y around 0 99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (- (+ (* (* y (+ -1.0 (* y -0.5))) (+ z -1.0)) (* (log y) (+ -1.0 x))) t))
double code(double x, double y, double z, double t) {
return (((y * (-1.0 + (y * -0.5))) * (z + -1.0)) + (log(y) * (-1.0 + x))) - 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 * ((-1.0d0) + (y * (-0.5d0)))) * (z + (-1.0d0))) + (log(y) * ((-1.0d0) + x))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((y * (-1.0 + (y * -0.5))) * (z + -1.0)) + (Math.log(y) * (-1.0 + x))) - t;
}
def code(x, y, z, t): return (((y * (-1.0 + (y * -0.5))) * (z + -1.0)) + (math.log(y) * (-1.0 + x))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(y * Float64(-1.0 + Float64(y * -0.5))) * Float64(z + -1.0)) + Float64(log(y) * Float64(-1.0 + x))) - t) end
function tmp = code(x, y, z, t) tmp = (((y * (-1.0 + (y * -0.5))) * (z + -1.0)) + (log(y) * (-1.0 + x))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(y * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(z + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(y \cdot \left(-1 + y \cdot -0.5\right)\right) \cdot \left(z + -1\right) + \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Initial program 88.9%
Taylor expanded in y around 0 99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1600.0) (not (<= x 1.0))) (- (* x (log y)) t) (- (- (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1600.0) || !(x <= 1.0)) {
tmp = (x * log(y)) - t;
} else {
tmp = -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 <= (-1600.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = (x * log(y)) - t
else
tmp = -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 <= -1600.0) || !(x <= 1.0)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = -Math.log(y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1600.0) or not (x <= 1.0): tmp = (x * math.log(y)) - t else: tmp = -math.log(y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1600.0) || !(x <= 1.0)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(-log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1600.0) || ~((x <= 1.0))) tmp = (x * log(y)) - t; else tmp = -log(y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1600.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1600 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(-\log y\right) - t\\
\end{array}
\end{array}
if x < -1600 or 1 < x Initial program 92.6%
Taylor expanded in y around 0 99.7%
Taylor expanded in x around inf 92.1%
*-commutative92.1%
Simplified92.1%
if -1600 < x < 1Initial program 85.8%
+-commutative85.8%
fma-define85.8%
sub-neg85.8%
metadata-eval85.8%
sub-neg85.8%
log1p-define100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around 0 83.9%
Taylor expanded in x around 0 82.5%
neg-mul-182.5%
Simplified82.5%
Final simplification86.9%
(FPCore (x y z t)
:precision binary64
(if (<= z -3.2e+168)
(- (* y (* z (+ -1.0 (* y (- (* y -0.3333333333333333) 0.5))))) t)
(if (<= z 2.5e+152)
(- (- (log y)) t)
(- (* y (* z (+ -1.0 (* y -0.5)))) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.2e+168) {
tmp = (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t;
} else if (z <= 2.5e+152) {
tmp = -log(y) - t;
} else {
tmp = (y * (z * (-1.0 + (y * -0.5)))) - 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.2d+168)) then
tmp = (y * (z * ((-1.0d0) + (y * ((y * (-0.3333333333333333d0)) - 0.5d0))))) - t
else if (z <= 2.5d+152) then
tmp = -log(y) - t
else
tmp = (y * (z * ((-1.0d0) + (y * (-0.5d0))))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.2e+168) {
tmp = (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t;
} else if (z <= 2.5e+152) {
tmp = -Math.log(y) - t;
} else {
tmp = (y * (z * (-1.0 + (y * -0.5)))) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.2e+168: tmp = (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t elif z <= 2.5e+152: tmp = -math.log(y) - t else: tmp = (y * (z * (-1.0 + (y * -0.5)))) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.2e+168) tmp = Float64(Float64(y * Float64(z * Float64(-1.0 + Float64(y * Float64(Float64(y * -0.3333333333333333) - 0.5))))) - t); elseif (z <= 2.5e+152) tmp = Float64(Float64(-log(y)) - t); else tmp = Float64(Float64(y * Float64(z * Float64(-1.0 + Float64(y * -0.5)))) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.2e+168) tmp = (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t; elseif (z <= 2.5e+152) tmp = -log(y) - t; else tmp = (y * (z * (-1.0 + (y * -0.5)))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.2e+168], N[(N[(y * N[(z * N[(-1.0 + N[(y * N[(N[(y * -0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[z, 2.5e+152], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision], N[(N[(y * N[(z * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+168}:\\
\;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot \left(y \cdot -0.3333333333333333 - 0.5\right)\right)\right) - t\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+152}:\\
\;\;\;\;\left(-\log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\
\end{array}
\end{array}
if z < -3.2000000000000001e168Initial program 46.8%
Taylor expanded in y around 0 99.8%
Taylor expanded in z around inf 75.1%
if -3.2000000000000001e168 < z < 2.5e152Initial program 98.1%
+-commutative98.1%
fma-define98.1%
sub-neg98.1%
metadata-eval98.1%
sub-neg98.1%
log1p-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 97.3%
Taylor expanded in x around 0 61.9%
neg-mul-161.9%
Simplified61.9%
if 2.5e152 < z Initial program 67.7%
Taylor expanded in y around 0 99.8%
Taylor expanded in z around inf 52.4%
Final simplification62.3%
(FPCore (x y z t) :precision binary64 (- (- (* (log y) (+ -1.0 x)) (* y (+ z -1.0))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) - (y * (z + -1.0))) - 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) * ((-1.0d0) + x)) - (y * (z + (-1.0d0)))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (-1.0 + x)) - (y * (z + -1.0))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) - (y * (z + -1.0))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) - Float64(y * Float64(z + -1.0))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (-1.0 + x)) - (y * (z + -1.0))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(-1 + x\right) - y \cdot \left(z + -1\right)\right) - t
\end{array}
Initial program 88.9%
Taylor expanded in y around 0 99.0%
+-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
fma-define99.0%
mul-1-neg99.0%
fma-neg99.0%
+-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
+-commutative99.0%
Simplified99.0%
Final simplification99.0%
(FPCore (x y z t) :precision binary64 (if (<= z -5.2e+177) (- (* y (* z (+ -1.0 (* y (- (* y -0.3333333333333333) 0.5))))) t) (- (* (log y) (+ -1.0 x)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.2e+177) {
tmp = (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t;
} else {
tmp = (log(y) * (-1.0 + x)) - 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 <= (-5.2d+177)) then
tmp = (y * (z * ((-1.0d0) + (y * ((y * (-0.3333333333333333d0)) - 0.5d0))))) - t
else
tmp = (log(y) * ((-1.0d0) + x)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.2e+177) {
tmp = (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t;
} else {
tmp = (Math.log(y) * (-1.0 + x)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.2e+177: tmp = (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t else: tmp = (math.log(y) * (-1.0 + x)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.2e+177) tmp = Float64(Float64(y * Float64(z * Float64(-1.0 + Float64(y * Float64(Float64(y * -0.3333333333333333) - 0.5))))) - t); else tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.2e+177) tmp = (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t; else tmp = (log(y) * (-1.0 + x)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.2e+177], N[(N[(y * N[(z * N[(-1.0 + N[(y * N[(N[(y * -0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+177}:\\
\;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot \left(y \cdot -0.3333333333333333 - 0.5\right)\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\end{array}
\end{array}
if z < -5.19999999999999959e177Initial program 46.4%
Taylor expanded in y around 0 99.9%
Taylor expanded in z around inf 77.0%
if -5.19999999999999959e177 < z Initial program 93.7%
+-commutative93.7%
fma-define93.7%
sub-neg93.7%
metadata-eval93.7%
sub-neg93.7%
log1p-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 92.9%
Final simplification91.2%
(FPCore (x y z t) :precision binary64 (- (- (* (log y) (+ -1.0 x)) (* z y)) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) - (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 = ((log(y) * ((-1.0d0) + x)) - (z * y)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (-1.0 + x)) - (z * y)) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) - (z * y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) - Float64(z * y)) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (-1.0 + x)) - (z * y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(-1 + x\right) - z \cdot y\right) - t
\end{array}
Initial program 88.9%
Taylor expanded in y around 0 99.0%
+-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
fma-define99.0%
mul-1-neg99.0%
fma-neg99.0%
+-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in z around inf 99.0%
Final simplification99.0%
(FPCore (x y z t) :precision binary64 (- (* y (* z (+ -1.0 (* y (- (* y -0.3333333333333333) 0.5))))) t))
double code(double x, double y, double z, double t) {
return (y * (z * (-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 = (y * (z * ((-1.0d0) + (y * ((y * (-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 * -0.3333333333333333) - 0.5))))) - t;
}
def code(x, y, z, t): return (y * (z * (-1.0 + (y * ((y * -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 * -0.3333333333333333) - 0.5))))) - t) end
function tmp = code(x, y, z, t) tmp = (y * (z * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5))))) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(z * N[(-1.0 + N[(y * N[(N[(y * -0.3333333333333333), $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 -0.3333333333333333 - 0.5\right)\right)\right) - t
\end{array}
Initial program 88.9%
Taylor expanded in y around 0 99.7%
Taylor expanded in z around inf 43.8%
Final simplification43.8%
(FPCore (x y z t) :precision binary64 (- (* y (* z (+ -1.0 (* y -0.5)))) t))
double code(double x, double y, double z, double t) {
return (y * (z * (-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 = (y * (z * ((-1.0d0) + (y * (-0.5d0))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * (z * (-1.0 + (y * -0.5)))) - t;
}
def code(x, y, z, t): return (y * (z * (-1.0 + (y * -0.5)))) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(z * Float64(-1.0 + Float64(y * -0.5)))) - t) end
function tmp = code(x, y, z, t) tmp = (y * (z * (-1.0 + (y * -0.5)))) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(z * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t
\end{array}
Initial program 88.9%
Taylor expanded in y around 0 99.7%
Taylor expanded in z around inf 43.7%
Final simplification43.7%
(FPCore (x y z t) :precision binary64 (- (* y (- 1.0 z)) t))
double code(double x, double y, double z, double t) {
return (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 = (y * (1.0d0 - z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * (1.0 - z)) - t;
}
def code(x, y, z, t): return (y * (1.0 - z)) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(1.0 - z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * (1.0 - z)) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(1 - z\right) - t
\end{array}
Initial program 88.9%
Taylor expanded in y around 0 99.0%
+-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
fma-define99.0%
mul-1-neg99.0%
fma-neg99.0%
+-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in y around inf 43.4%
Final simplification43.4%
(FPCore (x y z t) :precision binary64 (- (* z (- y)) t))
double code(double x, double y, double z, double t) {
return (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 = (z * -y) - t
end function
public static double code(double x, double y, double z, double t) {
return (z * -y) - t;
}
def code(x, y, z, t): return (z * -y) - t
function code(x, y, z, t) return Float64(Float64(z * Float64(-y)) - t) end
function tmp = code(x, y, z, t) tmp = (z * -y) - t; end
code[x_, y_, z_, t_] := N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(-y\right) - t
\end{array}
Initial program 88.9%
Taylor expanded in y around 0 99.7%
Taylor expanded in z around inf 43.7%
Taylor expanded in y around 0 43.2%
mul-1-neg43.2%
distribute-rgt-neg-in43.2%
Simplified43.2%
Final simplification43.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 88.9%
+-commutative88.9%
fma-define88.9%
sub-neg88.9%
metadata-eval88.9%
sub-neg88.9%
log1p-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 31.9%
neg-mul-131.9%
Simplified31.9%
Final simplification31.9%
herbie shell --seed 2024066
(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))