
(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 89.2%
+-commutative89.2%
fma-def89.2%
sub-neg89.2%
metadata-eval89.2%
sub-neg89.2%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (+ (- (* x (log y)) (log y)) (- (* (* y y) (+ 0.5 (* z -0.5))) (* y (+ z -1.0)))) t))
double code(double x, double y, double z, double t) {
return (((x * log(y)) - log(y)) + (((y * y) * (0.5 + (z * -0.5))) - (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 = (((x * log(y)) - log(y)) + (((y * y) * (0.5d0 + (z * (-0.5d0)))) - (y * (z + (-1.0d0))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x * Math.log(y)) - Math.log(y)) + (((y * y) * (0.5 + (z * -0.5))) - (y * (z + -1.0)))) - t;
}
def code(x, y, z, t): return (((x * math.log(y)) - math.log(y)) + (((y * y) * (0.5 + (z * -0.5))) - (y * (z + -1.0)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * log(y)) - log(y)) + Float64(Float64(Float64(y * y) * Float64(0.5 + Float64(z * -0.5))) - Float64(y * Float64(z + -1.0)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x * log(y)) - log(y)) + (((y * y) * (0.5 + (z * -0.5))) - (y * (z + -1.0)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y * y), $MachinePrecision] * N[(0.5 + N[(z * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot \log y - \log y\right) + \left(\left(y \cdot y\right) \cdot \left(0.5 + z \cdot -0.5\right) - y \cdot \left(z + -1\right)\right)\right) - t
\end{array}
Initial program 89.2%
Taylor expanded in y around 0 98.9%
mul-1-neg98.9%
unsub-neg98.9%
sub-neg98.9%
metadata-eval98.9%
associate-*r*98.9%
*-commutative98.9%
unpow298.9%
+-commutative98.9%
distribute-rgt-in98.9%
metadata-eval98.9%
sub-neg98.9%
metadata-eval98.9%
*-commutative98.9%
+-commutative98.9%
Simplified98.9%
*-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
distribute-lft-in98.9%
Applied egg-rr98.9%
Final simplification98.9%
(FPCore (x y z t) :precision binary64 (- (+ (- (* (* y y) (+ 0.5 (* z -0.5))) (* y (+ z -1.0))) (* (log y) (+ -1.0 x))) t))
double code(double x, double y, double z, double t) {
return ((((y * y) * (0.5 + (z * -0.5))) - (y * (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 * y) * (0.5d0 + (z * (-0.5d0)))) - (y * (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 * y) * (0.5 + (z * -0.5))) - (y * (z + -1.0))) + (Math.log(y) * (-1.0 + x))) - t;
}
def code(x, y, z, t): return ((((y * y) * (0.5 + (z * -0.5))) - (y * (z + -1.0))) + (math.log(y) * (-1.0 + x))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(Float64(y * y) * Float64(0.5 + Float64(z * -0.5))) - Float64(y * Float64(z + -1.0))) + Float64(log(y) * Float64(-1.0 + x))) - t) end
function tmp = code(x, y, z, t) tmp = ((((y * y) * (0.5 + (z * -0.5))) - (y * (z + -1.0))) + (log(y) * (-1.0 + x))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(y * y), $MachinePrecision] * N[(0.5 + N[(z * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(y \cdot y\right) \cdot \left(0.5 + z \cdot -0.5\right) - y \cdot \left(z + -1\right)\right) + \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Initial program 89.2%
Taylor expanded in y around 0 98.9%
mul-1-neg98.9%
unsub-neg98.9%
sub-neg98.9%
metadata-eval98.9%
associate-*r*98.9%
*-commutative98.9%
unpow298.9%
+-commutative98.9%
distribute-rgt-in98.9%
metadata-eval98.9%
sub-neg98.9%
metadata-eval98.9%
*-commutative98.9%
+-commutative98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ -1.0 x)) (- (* y (* y 0.5)) (* y (+ z -1.0)))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) + ((y * (y * 0.5)) - (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 * (y * 0.5d0)) - (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 * (y * 0.5)) - (y * (z + -1.0)))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) + ((y * (y * 0.5)) - (y * (z + -1.0)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) + Float64(Float64(y * Float64(y * 0.5)) - Float64(y * Float64(z + -1.0)))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (-1.0 + x)) + ((y * (y * 0.5)) - (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[(N[(y * N[(y * 0.5), $MachinePrecision]), $MachinePrecision] - N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(-1 + x\right) + \left(y \cdot \left(y \cdot 0.5\right) - y \cdot \left(z + -1\right)\right)\right) - t
\end{array}
Initial program 89.2%
Taylor expanded in y around 0 98.9%
mul-1-neg98.9%
unsub-neg98.9%
sub-neg98.9%
metadata-eval98.9%
associate-*r*98.9%
*-commutative98.9%
unpow298.9%
+-commutative98.9%
distribute-rgt-in98.9%
metadata-eval98.9%
sub-neg98.9%
metadata-eval98.9%
*-commutative98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in z around 0 98.6%
*-commutative98.6%
unpow298.6%
associate-*l*98.6%
Simplified98.6%
Final simplification98.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ -1.0 x) -2000000000000.0) (not (<= (+ -1.0 x) 4e+18))) (- (* (log y) (+ -1.0 x)) t) (- (- (- (log y)) (* z y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -2000000000000.0) || !((-1.0 + x) <= 4e+18)) {
tmp = (log(y) * (-1.0 + x)) - t;
} else {
tmp = (-log(y) - (z * y)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((((-1.0d0) + x) <= (-2000000000000.0d0)) .or. (.not. (((-1.0d0) + x) <= 4d+18))) then
tmp = (log(y) * ((-1.0d0) + x)) - t
else
tmp = (-log(y) - (z * 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) <= -2000000000000.0) || !((-1.0 + x) <= 4e+18)) {
tmp = (Math.log(y) * (-1.0 + x)) - t;
} else {
tmp = (-Math.log(y) - (z * y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((-1.0 + x) <= -2000000000000.0) or not ((-1.0 + x) <= 4e+18): tmp = (math.log(y) * (-1.0 + x)) - t else: tmp = (-math.log(y) - (z * y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(-1.0 + x) <= -2000000000000.0) || !(Float64(-1.0 + x) <= 4e+18)) tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); else tmp = Float64(Float64(Float64(-log(y)) - Float64(z * y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((-1.0 + x) <= -2000000000000.0) || ~(((-1.0 + x) <= 4e+18))) tmp = (log(y) * (-1.0 + x)) - t; else tmp = (-log(y) - (z * y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(-1.0 + x), $MachinePrecision], -2000000000000.0], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], 4e+18]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[((-N[Log[y], $MachinePrecision]) - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -2000000000000 \lor \neg \left(-1 + x \leq 4 \cdot 10^{+18}\right):\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-\log y\right) - z \cdot y\right) - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -2e12 or 4e18 < (-.f64 x 1) Initial program 94.1%
Taylor expanded in y around 0 93.5%
if -2e12 < (-.f64 x 1) < 4e18Initial program 84.2%
Taylor expanded in y around 0 98.0%
+-commutative98.0%
sub-neg98.0%
metadata-eval98.0%
mul-1-neg98.0%
unsub-neg98.0%
*-commutative98.0%
+-commutative98.0%
sub-neg98.0%
metadata-eval98.0%
*-commutative98.0%
+-commutative98.0%
Simplified98.0%
Taylor expanded in z around inf 97.9%
Taylor expanded in x around 0 96.8%
mul-1-neg96.8%
Simplified96.8%
Final simplification95.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (log y) (+ -1.0 x)))) (if (or (<= t -2.6e-5) (not (<= t 2.25e-54))) (- t_1 t) (- t_1 (* z y)))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * (-1.0 + x);
double tmp;
if ((t <= -2.6e-5) || !(t <= 2.25e-54)) {
tmp = t_1 - t;
} else {
tmp = t_1 - (z * y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = log(y) * ((-1.0d0) + x)
if ((t <= (-2.6d-5)) .or. (.not. (t <= 2.25d-54))) then
tmp = t_1 - t
else
tmp = t_1 - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.log(y) * (-1.0 + x);
double tmp;
if ((t <= -2.6e-5) || !(t <= 2.25e-54)) {
tmp = t_1 - t;
} else {
tmp = t_1 - (z * y);
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * (-1.0 + x) tmp = 0 if (t <= -2.6e-5) or not (t <= 2.25e-54): tmp = t_1 - t else: tmp = t_1 - (z * y) return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * Float64(-1.0 + x)) tmp = 0.0 if ((t <= -2.6e-5) || !(t <= 2.25e-54)) tmp = Float64(t_1 - t); else tmp = Float64(t_1 - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * (-1.0 + x); tmp = 0.0; if ((t <= -2.6e-5) || ~((t <= 2.25e-54))) tmp = t_1 - t; else tmp = t_1 - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t, -2.6e-5], N[Not[LessEqual[t, 2.25e-54]], $MachinePrecision]], N[(t$95$1 - t), $MachinePrecision], N[(t$95$1 - N[(z * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot \left(-1 + x\right)\\
\mathbf{if}\;t \leq -2.6 \cdot 10^{-5} \lor \neg \left(t \leq 2.25 \cdot 10^{-54}\right):\\
\;\;\;\;t_1 - t\\
\mathbf{else}:\\
\;\;\;\;t_1 - z \cdot y\\
\end{array}
\end{array}
if t < -2.59999999999999984e-5 or 2.2499999999999999e-54 < t Initial program 95.9%
Taylor expanded in y around 0 94.9%
if -2.59999999999999984e-5 < t < 2.2499999999999999e-54Initial program 80.5%
Taylor expanded in y around 0 97.9%
+-commutative97.9%
sub-neg97.9%
metadata-eval97.9%
mul-1-neg97.9%
unsub-neg97.9%
*-commutative97.9%
+-commutative97.9%
sub-neg97.9%
metadata-eval97.9%
*-commutative97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in z around inf 97.7%
Taylor expanded in t around 0 97.7%
Final simplification96.2%
(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 89.2%
Taylor expanded in y around 0 98.6%
+-commutative98.6%
sub-neg98.6%
metadata-eval98.6%
mul-1-neg98.6%
unsub-neg98.6%
*-commutative98.6%
+-commutative98.6%
sub-neg98.6%
metadata-eval98.6%
*-commutative98.6%
+-commutative98.6%
Simplified98.6%
Final simplification98.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ z -1.0) -2e+128) (not (<= (+ z -1.0) 6e+222))) (- (* z (- (* y (* y -0.5)) y)) t) (- (- (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((z + -1.0) <= -2e+128) || !((z + -1.0) <= 6e+222)) {
tmp = (z * ((y * (y * -0.5)) - 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 (((z + (-1.0d0)) <= (-2d+128)) .or. (.not. ((z + (-1.0d0)) <= 6d+222))) then
tmp = (z * ((y * (y * (-0.5d0))) - 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 (((z + -1.0) <= -2e+128) || !((z + -1.0) <= 6e+222)) {
tmp = (z * ((y * (y * -0.5)) - y)) - t;
} else {
tmp = -Math.log(y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z + -1.0) <= -2e+128) or not ((z + -1.0) <= 6e+222): tmp = (z * ((y * (y * -0.5)) - y)) - t else: tmp = -math.log(y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z + -1.0) <= -2e+128) || !(Float64(z + -1.0) <= 6e+222)) tmp = Float64(Float64(z * Float64(Float64(y * Float64(y * -0.5)) - 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 (((z + -1.0) <= -2e+128) || ~(((z + -1.0) <= 6e+222))) tmp = (z * ((y * (y * -0.5)) - y)) - t; else tmp = -log(y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z + -1.0), $MachinePrecision], -2e+128], N[Not[LessEqual[N[(z + -1.0), $MachinePrecision], 6e+222]], $MachinePrecision]], N[(N[(z * N[(N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z + -1 \leq -2 \cdot 10^{+128} \lor \neg \left(z + -1 \leq 6 \cdot 10^{+222}\right):\\
\;\;\;\;z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-\log y\right) - t\\
\end{array}
\end{array}
if (-.f64 z 1) < -2.0000000000000002e128 or 6.00000000000000028e222 < (-.f64 z 1) Initial program 62.9%
Taylor expanded in y around 0 98.0%
mul-1-neg98.0%
unsub-neg98.0%
sub-neg98.0%
metadata-eval98.0%
associate-*r*98.0%
*-commutative98.0%
unpow298.0%
+-commutative98.0%
distribute-rgt-in98.0%
metadata-eval98.0%
sub-neg98.0%
metadata-eval98.0%
*-commutative98.0%
+-commutative98.0%
Simplified98.0%
Taylor expanded in z around inf 63.2%
*-commutative63.2%
*-commutative63.2%
unpow263.2%
associate-*l*63.2%
Simplified63.2%
if -2.0000000000000002e128 < (-.f64 z 1) < 6.00000000000000028e222Initial program 98.3%
Taylor expanded in x around 0 58.0%
sub-neg58.0%
metadata-eval58.0%
*-commutative58.0%
fma-def58.0%
sub-neg58.0%
mul-1-neg58.0%
log1p-def59.4%
mul-1-neg59.4%
+-commutative59.4%
mul-1-neg59.4%
Simplified59.4%
Taylor expanded in y around 0 57.2%
neg-mul-157.2%
Simplified57.2%
Final simplification58.7%
(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 89.2%
Taylor expanded in y around 0 98.6%
+-commutative98.6%
sub-neg98.6%
metadata-eval98.6%
mul-1-neg98.6%
unsub-neg98.6%
*-commutative98.6%
+-commutative98.6%
sub-neg98.6%
metadata-eval98.6%
*-commutative98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in z around inf 98.5%
Final simplification98.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -350.0) (not (<= x 10500000000.0))) (- (* x (log y)) t) (- (- (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -350.0) || !(x <= 10500000000.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 <= (-350.0d0)) .or. (.not. (x <= 10500000000.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 <= -350.0) || !(x <= 10500000000.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 <= -350.0) or not (x <= 10500000000.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 <= -350.0) || !(x <= 10500000000.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 <= -350.0) || ~((x <= 10500000000.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, -350.0], N[Not[LessEqual[x, 10500000000.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 -350 \lor \neg \left(x \leq 10500000000\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(-\log y\right) - t\\
\end{array}
\end{array}
if x < -350 or 1.05e10 < x Initial program 93.6%
Taylor expanded in y around 0 99.3%
mul-1-neg99.3%
unsub-neg99.3%
sub-neg99.3%
metadata-eval99.3%
associate-*r*99.3%
*-commutative99.3%
unpow299.3%
+-commutative99.3%
distribute-rgt-in99.3%
metadata-eval99.3%
sub-neg99.3%
metadata-eval99.3%
*-commutative99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in x around inf 92.6%
if -350 < x < 1.05e10Initial program 84.5%
Taylor expanded in x around 0 84.3%
sub-neg84.3%
metadata-eval84.3%
*-commutative84.3%
fma-def84.3%
sub-neg84.3%
mul-1-neg84.3%
log1p-def99.7%
mul-1-neg99.7%
+-commutative99.7%
mul-1-neg99.7%
Simplified99.7%
Taylor expanded in y around 0 81.8%
neg-mul-181.8%
Simplified81.8%
Final simplification87.4%
(FPCore (x y z t) :precision binary64 (- (* (log y) (+ -1.0 x)) t))
double code(double x, double y, double z, double t) {
return (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 = (log(y) * ((-1.0d0) + x)) - t
end function
public static double code(double x, double y, double z, double t) {
return (Math.log(y) * (-1.0 + x)) - t;
}
def code(x, y, z, t): return (math.log(y) * (-1.0 + x)) - t
function code(x, y, z, t) return Float64(Float64(log(y) * Float64(-1.0 + x)) - t) end
function tmp = code(x, y, z, t) tmp = (log(y) * (-1.0 + x)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\log y \cdot \left(-1 + x\right) - t
\end{array}
Initial program 89.2%
Taylor expanded in y around 0 87.7%
Final simplification87.7%
(FPCore (x y z t) :precision binary64 (- (* z (- (* y (* y -0.5)) y)) t))
double code(double x, double y, double z, double t) {
return (z * ((y * (y * -0.5)) - 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 * (y * (-0.5d0))) - y)) - t
end function
public static double code(double x, double y, double z, double t) {
return (z * ((y * (y * -0.5)) - y)) - t;
}
def code(x, y, z, t): return (z * ((y * (y * -0.5)) - y)) - t
function code(x, y, z, t) return Float64(Float64(z * Float64(Float64(y * Float64(y * -0.5)) - y)) - t) end
function tmp = code(x, y, z, t) tmp = (z * ((y * (y * -0.5)) - y)) - t; end
code[x_, y_, z_, t_] := N[(N[(z * N[(N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right) - t
\end{array}
Initial program 89.2%
Taylor expanded in y around 0 98.9%
mul-1-neg98.9%
unsub-neg98.9%
sub-neg98.9%
metadata-eval98.9%
associate-*r*98.9%
*-commutative98.9%
unpow298.9%
+-commutative98.9%
distribute-rgt-in98.9%
metadata-eval98.9%
sub-neg98.9%
metadata-eval98.9%
*-commutative98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in z around inf 43.4%
*-commutative43.4%
*-commutative43.4%
unpow243.4%
associate-*l*43.4%
Simplified43.4%
Final simplification43.4%
(FPCore (x y z t) :precision binary64 (- (- y (* z y)) t))
double code(double x, double y, double z, double t) {
return (y - (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 = (y - (z * y)) - t
end function
public static double code(double x, double y, double z, double t) {
return (y - (z * y)) - t;
}
def code(x, y, z, t): return (y - (z * y)) - t
function code(x, y, z, t) return Float64(Float64(y - Float64(z * y)) - t) end
function tmp = code(x, y, z, t) tmp = (y - (z * y)) - t; end
code[x_, y_, z_, t_] := N[(N[(y - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(y - z \cdot y\right) - t
\end{array}
Initial program 89.2%
sub-neg89.2%
metadata-eval89.2%
flip-+68.2%
associate-*l/67.8%
metadata-eval67.8%
fma-neg67.8%
metadata-eval67.8%
sub-neg67.8%
metadata-eval67.8%
+-commutative67.8%
Applied egg-rr67.8%
Taylor expanded in y around 0 76.1%
mul-1-neg76.1%
Simplified76.1%
Taylor expanded in y around inf 43.4%
sub-neg43.4%
metadata-eval43.4%
*-commutative43.4%
distribute-rgt-in43.4%
*-commutative43.4%
neg-mul-143.4%
distribute-lft-out43.4%
neg-mul-143.4%
remove-double-neg43.4%
+-commutative43.4%
mul-1-neg43.4%
unsub-neg43.4%
Simplified43.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 89.2%
Taylor expanded in y around 0 98.9%
mul-1-neg98.9%
unsub-neg98.9%
sub-neg98.9%
metadata-eval98.9%
associate-*r*98.9%
*-commutative98.9%
unpow298.9%
+-commutative98.9%
distribute-rgt-in98.9%
metadata-eval98.9%
sub-neg98.9%
metadata-eval98.9%
*-commutative98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in z around inf 43.4%
*-commutative43.4%
*-commutative43.4%
unpow243.4%
associate-*l*43.4%
Simplified43.4%
Taylor expanded in y around 0 43.2%
associate-*r*43.2%
neg-mul-143.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 89.2%
+-commutative89.2%
fma-def89.2%
sub-neg89.2%
metadata-eval89.2%
sub-neg89.2%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in t around inf 33.6%
neg-mul-133.6%
Simplified33.6%
Final simplification33.6%
herbie shell --seed 2023268
(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))