
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
(FPCore (x y z t) :precision binary64 (- (+ (* (+ x -1.0) (log y)) (* y (* z (+ (* y (- (* y -0.3333333333333333) 0.5)) -1.0)))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + (y * (z * ((y * ((y * -0.3333333333333333) - 0.5)) + -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 = (((x + (-1.0d0)) * log(y)) + (y * (z * ((y * ((y * (-0.3333333333333333d0)) - 0.5d0)) + (-1.0d0))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) + (y * (z * ((y * ((y * -0.3333333333333333) - 0.5)) + -1.0)))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + (y * (z * ((y * ((y * -0.3333333333333333) - 0.5)) + -1.0)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(y * Float64(z * Float64(Float64(y * Float64(Float64(y * -0.3333333333333333) - 0.5)) + -1.0)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + (y * (z * ((y * ((y * -0.3333333333333333) - 0.5)) + -1.0)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(y * N[(z * N[(N[(y * N[(N[(y * -0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + y \cdot \left(z \cdot \left(y \cdot \left(y \cdot -0.3333333333333333 - 0.5\right) + -1\right)\right)\right) - t
\end{array}
Initial program 89.8%
Taylor expanded in y around 0 99.8%
Taylor expanded in z around inf 99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (- (log y)) t)) (t_2 (- (* x (log y)) t)))
(if (<= x -280000.0)
t_2
(if (<= x 6.8e-218)
t_1
(if (<= x 2.1e-171) (- (* y (- 1.0 z)) t) (if (<= x 1.0) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = -log(y) - t;
double t_2 = (x * log(y)) - t;
double tmp;
if (x <= -280000.0) {
tmp = t_2;
} else if (x <= 6.8e-218) {
tmp = t_1;
} else if (x <= 2.1e-171) {
tmp = (y * (1.0 - z)) - t;
} else if (x <= 1.0) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = -log(y) - t
t_2 = (x * log(y)) - t
if (x <= (-280000.0d0)) then
tmp = t_2
else if (x <= 6.8d-218) then
tmp = t_1
else if (x <= 2.1d-171) then
tmp = (y * (1.0d0 - z)) - t
else if (x <= 1.0d0) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = -Math.log(y) - t;
double t_2 = (x * Math.log(y)) - t;
double tmp;
if (x <= -280000.0) {
tmp = t_2;
} else if (x <= 6.8e-218) {
tmp = t_1;
} else if (x <= 2.1e-171) {
tmp = (y * (1.0 - z)) - t;
} else if (x <= 1.0) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = -math.log(y) - t t_2 = (x * math.log(y)) - t tmp = 0 if x <= -280000.0: tmp = t_2 elif x <= 6.8e-218: tmp = t_1 elif x <= 2.1e-171: tmp = (y * (1.0 - z)) - t elif x <= 1.0: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-log(y)) - t) t_2 = Float64(Float64(x * log(y)) - t) tmp = 0.0 if (x <= -280000.0) tmp = t_2; elseif (x <= 6.8e-218) tmp = t_1; elseif (x <= 2.1e-171) tmp = Float64(Float64(y * Float64(1.0 - z)) - t); elseif (x <= 1.0) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -log(y) - t; t_2 = (x * log(y)) - t; tmp = 0.0; if (x <= -280000.0) tmp = t_2; elseif (x <= 6.8e-218) tmp = t_1; elseif (x <= 2.1e-171) tmp = (y * (1.0 - z)) - t; elseif (x <= 1.0) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[x, -280000.0], t$95$2, If[LessEqual[x, 6.8e-218], t$95$1, If[LessEqual[x, 2.1e-171], N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[x, 1.0], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-\log y\right) - t\\
t_2 := x \cdot \log y - t\\
\mathbf{if}\;x \leq -280000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-218}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{-171}:\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if x < -2.8e5 or 1 < x Initial program 92.7%
+-commutative92.7%
fma-define92.7%
sub-neg92.7%
metadata-eval92.7%
sub-neg92.7%
log1p-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 74.5%
sub-neg74.5%
log1p-define81.5%
+-commutative81.5%
mul-1-neg81.5%
unsub-neg81.5%
sub-neg81.5%
metadata-eval81.5%
*-commutative81.5%
div-sub81.5%
*-commutative81.5%
+-commutative81.5%
sub-neg81.5%
log1p-define81.5%
Simplified81.5%
Taylor expanded in x around inf 91.3%
*-commutative91.3%
Simplified91.3%
if -2.8e5 < x < 6.79999999999999971e-218 or 2.1e-171 < x < 1Initial program 89.8%
Taylor expanded in y around 0 88.7%
Taylor expanded in x around 0 88.2%
mul-1-neg88.2%
Simplified88.2%
if 6.79999999999999971e-218 < x < 2.1e-171Initial program 46.7%
Taylor expanded in y around 0 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
distribute-neg-in100.0%
metadata-eval100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
Final simplification90.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ x -1.0) -1.002) (not (<= (+ x -1.0) -1.0))) (- (* (+ x -1.0) (log y)) t) (- (- (* y (- 1.0 z)) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x + -1.0) <= -1.002) || !((x + -1.0) <= -1.0)) {
tmp = ((x + -1.0) * log(y)) - 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 (((x + (-1.0d0)) <= (-1.002d0)) .or. (.not. ((x + (-1.0d0)) <= (-1.0d0)))) then
tmp = ((x + (-1.0d0)) * log(y)) - 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 (((x + -1.0) <= -1.002) || !((x + -1.0) <= -1.0)) {
tmp = ((x + -1.0) * Math.log(y)) - t;
} else {
tmp = ((y * (1.0 - z)) - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x + -1.0) <= -1.002) or not ((x + -1.0) <= -1.0): tmp = ((x + -1.0) * math.log(y)) - t else: tmp = ((y * (1.0 - z)) - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x + -1.0) <= -1.002) || !(Float64(x + -1.0) <= -1.0)) tmp = Float64(Float64(Float64(x + -1.0) * log(y)) - 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 (((x + -1.0) <= -1.002) || ~(((x + -1.0) <= -1.0))) tmp = ((x + -1.0) * log(y)) - t; else tmp = ((y * (1.0 - z)) - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x + -1.0), $MachinePrecision], -1.002], N[Not[LessEqual[N[(x + -1.0), $MachinePrecision], -1.0]], $MachinePrecision]], N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $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}\;x + -1 \leq -1.002 \lor \neg \left(x + -1 \leq -1\right):\\
\;\;\;\;\left(x + -1\right) \cdot \log y - 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.002 or -1 < (-.f64 x #s(literal 1 binary64)) Initial program 92.9%
Taylor expanded in y around 0 92.5%
if -1.002 < (-.f64 x #s(literal 1 binary64)) < -1Initial program 86.1%
Taylor expanded in y around 0 99.3%
mul-1-neg99.3%
distribute-rgt-neg-in99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
distribute-neg-in99.3%
metadata-eval99.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in x around 0 99.2%
mul-1-neg99.2%
Simplified99.2%
Final simplification95.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ x -1.0) -20000000.0) (not (<= (+ x -1.0) -0.5))) (- (- (* x (log y)) (* y z)) t) (- (- (* y (- 1.0 z)) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x + -1.0) <= -20000000.0) || !((x + -1.0) <= -0.5)) {
tmp = ((x * log(y)) - (y * z)) - 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 (((x + (-1.0d0)) <= (-20000000.0d0)) .or. (.not. ((x + (-1.0d0)) <= (-0.5d0)))) then
tmp = ((x * log(y)) - (y * z)) - 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 (((x + -1.0) <= -20000000.0) || !((x + -1.0) <= -0.5)) {
tmp = ((x * Math.log(y)) - (y * z)) - t;
} else {
tmp = ((y * (1.0 - z)) - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x + -1.0) <= -20000000.0) or not ((x + -1.0) <= -0.5): tmp = ((x * math.log(y)) - (y * z)) - t else: tmp = ((y * (1.0 - z)) - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x + -1.0) <= -20000000.0) || !(Float64(x + -1.0) <= -0.5)) tmp = Float64(Float64(Float64(x * log(y)) - Float64(y * z)) - 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 (((x + -1.0) <= -20000000.0) || ~(((x + -1.0) <= -0.5))) tmp = ((x * log(y)) - (y * z)) - t; else tmp = ((y * (1.0 - z)) - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x + -1.0), $MachinePrecision], -20000000.0], N[Not[LessEqual[N[(x + -1.0), $MachinePrecision], -0.5]], $MachinePrecision]], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $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}\;x + -1 \leq -20000000 \lor \neg \left(x + -1 \leq -0.5\right):\\
\;\;\;\;\left(x \cdot \log y - y \cdot z\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)) < -2e7 or -0.5 < (-.f64 x #s(literal 1 binary64)) Initial program 92.7%
Taylor expanded in y around 0 99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in x around inf 98.4%
*-commutative98.4%
Simplified98.4%
Taylor expanded in y around 0 98.1%
associate-*r*98.1%
neg-mul-198.1%
Simplified98.1%
if -2e7 < (-.f64 x #s(literal 1 binary64)) < -0.5Initial program 86.7%
Taylor expanded in y around 0 99.3%
mul-1-neg99.3%
distribute-rgt-neg-in99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
distribute-neg-in99.3%
metadata-eval99.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in x around 0 98.7%
mul-1-neg98.7%
Simplified98.7%
Final simplification98.4%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ x -1.0) (log y)) (* (+ z -1.0) (* y (+ (* y -0.5) -1.0)))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + ((z + -1.0) * (y * ((y * -0.5) + -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 = (((x + (-1.0d0)) * log(y)) + ((z + (-1.0d0)) * (y * ((y * (-0.5d0)) + (-1.0d0))))) - 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) * (y * ((y * -0.5) + -1.0)))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + ((z + -1.0) * (y * ((y * -0.5) + -1.0)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(Float64(z + -1.0) * Float64(y * Float64(Float64(y * -0.5) + -1.0)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + ((z + -1.0) * (y * ((y * -0.5) + -1.0)))) - 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[(y * N[(N[(y * -0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + \left(z + -1\right) \cdot \left(y \cdot \left(y \cdot -0.5 + -1\right)\right)\right) - t
\end{array}
Initial program 89.8%
Taylor expanded in y around 0 99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ x -1.0) (log y)) (* y (* z (+ (* y -0.5) -1.0)))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + (y * (z * ((y * -0.5) + -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 = (((x + (-1.0d0)) * log(y)) + (y * (z * ((y * (-0.5d0)) + (-1.0d0))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) + (y * (z * ((y * -0.5) + -1.0)))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + (y * (z * ((y * -0.5) + -1.0)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(y * Float64(z * Float64(Float64(y * -0.5) + -1.0)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + (y * (z * ((y * -0.5) + -1.0)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(y * N[(z * N[(N[(y * -0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + y \cdot \left(z \cdot \left(y \cdot -0.5 + -1\right)\right)\right) - t
\end{array}
Initial program 89.8%
Taylor expanded in y around 0 99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in y around 0 99.7%
associate-*r*99.7%
distribute-rgt-out99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.02e+103) (not (<= z 2.7e+126))) (- (* y (- 1.0 z)) t) (- (- (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.02e+103) || !(z <= 2.7e+126)) {
tmp = (y * (1.0 - z)) - 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 ((z <= (-1.02d+103)) .or. (.not. (z <= 2.7d+126))) then
tmp = (y * (1.0d0 - z)) - 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 ((z <= -1.02e+103) || !(z <= 2.7e+126)) {
tmp = (y * (1.0 - z)) - t;
} else {
tmp = -Math.log(y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.02e+103) or not (z <= 2.7e+126): tmp = (y * (1.0 - z)) - t else: tmp = -math.log(y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.02e+103) || !(z <= 2.7e+126)) tmp = Float64(Float64(y * Float64(1.0 - z)) - t); else tmp = Float64(Float64(-log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.02e+103) || ~((z <= 2.7e+126))) tmp = (y * (1.0 - z)) - t; else tmp = -log(y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.02e+103], N[Not[LessEqual[z, 2.7e+126]], $MachinePrecision]], N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{+103} \lor \neg \left(z \leq 2.7 \cdot 10^{+126}\right):\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-\log y\right) - t\\
\end{array}
\end{array}
if z < -1.01999999999999991e103 or 2.70000000000000002e126 < z Initial program 71.9%
Taylor expanded in y around 0 98.3%
mul-1-neg98.3%
distribute-rgt-neg-in98.3%
sub-neg98.3%
metadata-eval98.3%
+-commutative98.3%
distribute-neg-in98.3%
metadata-eval98.3%
unsub-neg98.3%
Simplified98.3%
Taylor expanded in y around inf 66.4%
if -1.01999999999999991e103 < z < 2.70000000000000002e126Initial program 98.5%
Taylor expanded in y around 0 98.5%
Taylor expanded in x around 0 62.4%
mul-1-neg62.4%
Simplified62.4%
Final simplification63.7%
(FPCore (x y z t) :precision binary64 (- (- (* (+ x -1.0) (log y)) (* y z)) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) - (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 = (((x + (-1.0d0)) * log(y)) - (y * z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) - (y * z)) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) - (y * z)) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) - Float64(y * z)) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) - (y * z)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y - y \cdot z\right) - t
\end{array}
Initial program 89.8%
Taylor expanded in y around 0 99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in y around 0 99.7%
associate-*r*99.7%
distribute-rgt-out99.7%
Simplified99.7%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
*-commutative99.3%
mul-1-neg99.3%
*-commutative99.3%
unsub-neg99.3%
*-commutative99.3%
Simplified99.3%
Final simplification99.3%
(FPCore (x y z t) :precision binary64 (- (* (+ x -1.0) (log y)) t))
double code(double x, double y, double z, double t) {
return ((x + -1.0) * log(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)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x + -1.0) * Math.log(y)) - t;
}
def code(x, y, z, t): return ((x + -1.0) * math.log(y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(x + -1.0) * log(y)) - t) end
function tmp = code(x, y, z, t) tmp = ((x + -1.0) * log(y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x + -1\right) \cdot \log y - t
\end{array}
Initial program 89.8%
Taylor expanded in y around 0 89.1%
Final simplification89.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -9600000000.0) (not (<= t 2.9e+40))) (- t) (* y (- 1.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9600000000.0) || !(t <= 2.9e+40)) {
tmp = -t;
} else {
tmp = y * (1.0 - z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-9600000000.0d0)) .or. (.not. (t <= 2.9d+40))) then
tmp = -t
else
tmp = y * (1.0d0 - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9600000000.0) || !(t <= 2.9e+40)) {
tmp = -t;
} else {
tmp = y * (1.0 - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -9600000000.0) or not (t <= 2.9e+40): tmp = -t else: tmp = y * (1.0 - z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -9600000000.0) || !(t <= 2.9e+40)) tmp = Float64(-t); else tmp = Float64(y * Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -9600000000.0) || ~((t <= 2.9e+40))) tmp = -t; else tmp = y * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -9600000000.0], N[Not[LessEqual[t, 2.9e+40]], $MachinePrecision]], (-t), N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9600000000 \lor \neg \left(t \leq 2.9 \cdot 10^{+40}\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if t < -9.6e9 or 2.90000000000000017e40 < t Initial program 95.4%
Taylor expanded in t around inf 76.2%
neg-mul-176.2%
Simplified76.2%
if -9.6e9 < t < 2.90000000000000017e40Initial program 84.2%
Taylor expanded in y around 0 99.1%
mul-1-neg99.1%
distribute-rgt-neg-in99.1%
sub-neg99.1%
metadata-eval99.1%
+-commutative99.1%
distribute-neg-in99.1%
metadata-eval99.1%
unsub-neg99.1%
Simplified99.1%
Taylor expanded in y around inf 19.1%
Taylor expanded in y around inf 17.5%
Final simplification46.8%
(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 89.8%
Taylor expanded in y around 0 99.3%
mul-1-neg99.3%
distribute-rgt-neg-in99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
distribute-neg-in99.3%
metadata-eval99.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in y around inf 50.0%
Final simplification50.0%
(FPCore (x y z t) :precision binary64 (- y t))
double code(double x, double y, double z, double t) {
return 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 = y - t
end function
public static double code(double x, double y, double z, double t) {
return y - t;
}
def code(x, y, z, t): return y - t
function code(x, y, z, t) return Float64(y - t) end
function tmp = code(x, y, z, t) tmp = y - t; end
code[x_, y_, z_, t_] := N[(y - t), $MachinePrecision]
\begin{array}{l}
\\
y - t
\end{array}
Initial program 89.8%
Taylor expanded in y around 0 99.3%
mul-1-neg99.3%
distribute-rgt-neg-in99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
distribute-neg-in99.3%
metadata-eval99.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in y around inf 50.0%
Taylor expanded in z around 0 40.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 89.8%
Taylor expanded in t around inf 40.4%
neg-mul-140.4%
Simplified40.4%
Final simplification40.4%
herbie shell --seed 2024079
(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))