
(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 91.1%
+-commutative91.1%
fma-def91.1%
sub-neg91.1%
metadata-eval91.1%
sub-neg91.1%
log1p-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (- (+ (fma -1.0 (* y (+ z -1.0)) (* -0.5 (* (+ z -1.0) (* y y)))) (* (log y) (+ -1.0 x))) t))
double code(double x, double y, double z, double t) {
return (fma(-1.0, (y * (z + -1.0)), (-0.5 * ((z + -1.0) * (y * y)))) + (log(y) * (-1.0 + x))) - t;
}
function code(x, y, z, t) return Float64(Float64(fma(-1.0, Float64(y * Float64(z + -1.0)), Float64(-0.5 * Float64(Float64(z + -1.0) * Float64(y * y)))) + Float64(log(y) * Float64(-1.0 + x))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(-1.0 * N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(N[(z + -1.0), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\mathsf{fma}\left(-1, y \cdot \left(z + -1\right), -0.5 \cdot \left(\left(z + -1\right) \cdot \left(y \cdot y\right)\right)\right) + \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 99.8%
fma-def99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
unpow299.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (- (- (* x (log y)) (* y (+ z -1.0))) (log y)) t))
double code(double x, double y, double z, double t) {
return (((x * log(y)) - (y * (z + -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 * log(y)) - (y * (z + (-1.0d0)))) - log(y)) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x * Math.log(y)) - (y * (z + -1.0))) - Math.log(y)) - t;
}
def code(x, y, z, t): return (((x * math.log(y)) - (y * (z + -1.0))) - math.log(y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * log(y)) - Float64(y * Float64(z + -1.0))) - log(y)) - t) end
function tmp = code(x, y, z, t) tmp = (((x * log(y)) - (y * (z + -1.0))) - log(y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot \log y - y \cdot \left(z + -1\right)\right) - \log y\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 99.8%
fma-def99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
unpow299.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
*-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
distribute-lft-in99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 99.4%
Final simplification99.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) (+ -1.0 x))))
(if (<= t -3.2e-7)
(- t_1 t)
(if (<= t 2.35e-107) (+ t_1 (- y (* z y))) (- (+ y t_1) t)))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * (-1.0 + x);
double tmp;
if (t <= -3.2e-7) {
tmp = t_1 - t;
} else if (t <= 2.35e-107) {
tmp = t_1 + (y - (z * y));
} else {
tmp = (y + t_1) - 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) :: t_1
real(8) :: tmp
t_1 = log(y) * ((-1.0d0) + x)
if (t <= (-3.2d-7)) then
tmp = t_1 - t
else if (t <= 2.35d-107) then
tmp = t_1 + (y - (z * y))
else
tmp = (y + t_1) - t
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 <= -3.2e-7) {
tmp = t_1 - t;
} else if (t <= 2.35e-107) {
tmp = t_1 + (y - (z * y));
} else {
tmp = (y + t_1) - t;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * (-1.0 + x) tmp = 0 if t <= -3.2e-7: tmp = t_1 - t elif t <= 2.35e-107: tmp = t_1 + (y - (z * y)) else: tmp = (y + t_1) - t return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * Float64(-1.0 + x)) tmp = 0.0 if (t <= -3.2e-7) tmp = Float64(t_1 - t); elseif (t <= 2.35e-107) tmp = Float64(t_1 + Float64(y - Float64(z * y))); else tmp = Float64(Float64(y + t_1) - t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * (-1.0 + x); tmp = 0.0; if (t <= -3.2e-7) tmp = t_1 - t; elseif (t <= 2.35e-107) tmp = t_1 + (y - (z * y)); else tmp = (y + t_1) - t; 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[LessEqual[t, -3.2e-7], N[(t$95$1 - t), $MachinePrecision], If[LessEqual[t, 2.35e-107], N[(t$95$1 + N[(y - N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y + t$95$1), $MachinePrecision] - t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot \left(-1 + x\right)\\
\mathbf{if}\;t \leq -3.2 \cdot 10^{-7}:\\
\;\;\;\;t_1 - t\\
\mathbf{elif}\;t \leq 2.35 \cdot 10^{-107}:\\
\;\;\;\;t_1 + \left(y - z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y + t_1\right) - t\\
\end{array}
\end{array}
if t < -3.2000000000000001e-7Initial program 94.0%
+-commutative94.0%
fma-def94.0%
sub-neg94.0%
metadata-eval94.0%
sub-neg94.0%
log1p-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 93.2%
if -3.2000000000000001e-7 < t < 2.34999999999999999e-107Initial program 83.1%
Taylor expanded in y around 0 99.7%
fma-def99.7%
sub-neg99.7%
metadata-eval99.7%
+-commutative99.7%
unpow299.7%
sub-neg99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
*-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
distribute-lft-in99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 99.4%
Taylor expanded in t around 0 99.2%
remove-double-neg99.2%
distribute-rgt-neg-in99.2%
log-rec99.2%
mul-1-neg99.2%
distribute-lft-out99.2%
+-commutative99.2%
neg-mul-199.2%
distribute-lft-out99.2%
associate-+r+99.2%
mul-1-neg99.2%
unsub-neg99.2%
Simplified99.2%
if 2.34999999999999999e-107 < t Initial program 98.0%
Taylor expanded in z around 0 97.6%
+-commutative97.6%
sub-neg97.6%
metadata-eval97.6%
*-commutative97.6%
mul-1-neg97.6%
unsub-neg97.6%
*-commutative97.6%
+-commutative97.6%
sub-neg97.6%
mul-1-neg97.6%
log1p-def97.6%
mul-1-neg97.6%
Simplified97.6%
Taylor expanded in y around 0 97.3%
Final simplification97.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ -1.0 x) -5e+36) (not (<= (+ -1.0 x) 20.0))) (- (* x (log y)) t) (- y (+ (log y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -5e+36) || !((-1.0 + x) <= 20.0)) {
tmp = (x * log(y)) - 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 ((((-1.0d0) + x) <= (-5d+36)) .or. (.not. (((-1.0d0) + x) <= 20.0d0))) then
tmp = (x * log(y)) - 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 (((-1.0 + x) <= -5e+36) || !((-1.0 + x) <= 20.0)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = y - (Math.log(y) + t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((-1.0 + x) <= -5e+36) or not ((-1.0 + x) <= 20.0): tmp = (x * math.log(y)) - t else: tmp = y - (math.log(y) + t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(-1.0 + x) <= -5e+36) || !(Float64(-1.0 + x) <= 20.0)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(y - Float64(log(y) + t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((-1.0 + x) <= -5e+36) || ~(((-1.0 + x) <= 20.0))) tmp = (x * log(y)) - t; else tmp = y - (log(y) + t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(-1.0 + x), $MachinePrecision], -5e+36], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], 20.0]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(y - N[(N[Log[y], $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -5 \cdot 10^{+36} \lor \neg \left(-1 + x \leq 20\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;y - \left(\log y + t\right)\\
\end{array}
\end{array}
if (-.f64 x 1) < -4.99999999999999977e36 or 20 < (-.f64 x 1) Initial program 93.2%
Taylor expanded in y around 0 99.8%
fma-def99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
unpow299.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 92.8%
*-commutative92.8%
Simplified92.8%
if -4.99999999999999977e36 < (-.f64 x 1) < 20Initial program 89.0%
Taylor expanded in z around 0 88.4%
+-commutative88.4%
sub-neg88.4%
metadata-eval88.4%
*-commutative88.4%
mul-1-neg88.4%
unsub-neg88.4%
*-commutative88.4%
+-commutative88.4%
sub-neg88.4%
mul-1-neg88.4%
log1p-def88.4%
mul-1-neg88.4%
Simplified88.4%
Taylor expanded in x around 0 87.6%
mul-1-neg87.6%
Simplified87.6%
Taylor expanded in y around 0 87.1%
mul-1-neg87.1%
unsub-neg87.1%
+-commutative87.1%
Simplified87.1%
Final simplification89.9%
(FPCore (x y z t) :precision binary64 (if (<= z -1.9e+208) (- (* z (- (* -0.5 (* y y)) y)) t) (if (<= z 4e+217) (- (+ y (* (log y) (+ -1.0 x))) t) (- (* z (- y)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.9e+208) {
tmp = (z * ((-0.5 * (y * y)) - y)) - t;
} else if (z <= 4e+217) {
tmp = (y + (log(y) * (-1.0 + x))) - t;
} else {
tmp = (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 (z <= (-1.9d+208)) then
tmp = (z * (((-0.5d0) * (y * y)) - y)) - t
else if (z <= 4d+217) then
tmp = (y + (log(y) * ((-1.0d0) + x))) - t
else
tmp = (z * -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.9e+208) {
tmp = (z * ((-0.5 * (y * y)) - y)) - t;
} else if (z <= 4e+217) {
tmp = (y + (Math.log(y) * (-1.0 + x))) - t;
} else {
tmp = (z * -y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.9e+208: tmp = (z * ((-0.5 * (y * y)) - y)) - t elif z <= 4e+217: tmp = (y + (math.log(y) * (-1.0 + x))) - t else: tmp = (z * -y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.9e+208) tmp = Float64(Float64(z * Float64(Float64(-0.5 * Float64(y * y)) - y)) - t); elseif (z <= 4e+217) tmp = Float64(Float64(y + Float64(log(y) * Float64(-1.0 + x))) - t); else tmp = Float64(Float64(z * Float64(-y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.9e+208) tmp = (z * ((-0.5 * (y * y)) - y)) - t; elseif (z <= 4e+217) tmp = (y + (log(y) * (-1.0 + x))) - t; else tmp = (z * -y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.9e+208], N[(N[(z * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[z, 4e+217], N[(N[(y + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+208}:\\
\;\;\;\;z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+217}:\\
\;\;\;\;\left(y + \log y \cdot \left(-1 + x\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right) - t\\
\end{array}
\end{array}
if z < -1.9000000000000001e208Initial program 58.0%
Taylor expanded in y around 0 99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
unpow299.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 74.9%
neg-mul-174.9%
+-commutative74.9%
unsub-neg74.9%
*-commutative74.9%
unpow274.9%
Simplified74.9%
if -1.9000000000000001e208 < z < 3.99999999999999984e217Initial program 97.4%
Taylor expanded in z around 0 97.0%
+-commutative97.0%
sub-neg97.0%
metadata-eval97.0%
*-commutative97.0%
mul-1-neg97.0%
unsub-neg97.0%
*-commutative97.0%
+-commutative97.0%
sub-neg97.0%
mul-1-neg97.0%
log1p-def97.0%
mul-1-neg97.0%
Simplified97.0%
Taylor expanded in y around 0 96.7%
if 3.99999999999999984e217 < z Initial program 46.0%
Taylor expanded in y around 0 100.0%
fma-def100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
unpow2100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in z around inf 82.6%
neg-mul-182.6%
+-commutative82.6%
unsub-neg82.6%
*-commutative82.6%
unpow282.6%
Simplified82.6%
Taylor expanded in y around 0 82.6%
neg-mul-182.6%
+-commutative82.6%
unsub-neg82.6%
mul-1-neg82.6%
Simplified82.6%
Final simplification93.8%
(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 91.1%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
mul-1-neg99.4%
unsub-neg99.4%
*-commutative99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (if (<= z -3.7e+208) (- (* z (- (* -0.5 (* y y)) y)) t) (if (<= z 4.1e+214) (- (* (log y) (+ -1.0 x)) t) (- (* z (- y)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.7e+208) {
tmp = (z * ((-0.5 * (y * y)) - y)) - t;
} else if (z <= 4.1e+214) {
tmp = (log(y) * (-1.0 + x)) - t;
} else {
tmp = (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 (z <= (-3.7d+208)) then
tmp = (z * (((-0.5d0) * (y * y)) - y)) - t
else if (z <= 4.1d+214) then
tmp = (log(y) * ((-1.0d0) + x)) - t
else
tmp = (z * -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.7e+208) {
tmp = (z * ((-0.5 * (y * y)) - y)) - t;
} else if (z <= 4.1e+214) {
tmp = (Math.log(y) * (-1.0 + x)) - t;
} else {
tmp = (z * -y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.7e+208: tmp = (z * ((-0.5 * (y * y)) - y)) - t elif z <= 4.1e+214: tmp = (math.log(y) * (-1.0 + x)) - t else: tmp = (z * -y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.7e+208) tmp = Float64(Float64(z * Float64(Float64(-0.5 * Float64(y * y)) - y)) - t); elseif (z <= 4.1e+214) tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); else tmp = Float64(Float64(z * Float64(-y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.7e+208) tmp = (z * ((-0.5 * (y * y)) - y)) - t; elseif (z <= 4.1e+214) tmp = (log(y) * (-1.0 + x)) - t; else tmp = (z * -y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.7e+208], N[(N[(z * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[z, 4.1e+214], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{+208}:\\
\;\;\;\;z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{+214}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right) - t\\
\end{array}
\end{array}
if z < -3.69999999999999989e208Initial program 58.0%
Taylor expanded in y around 0 99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
unpow299.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 74.9%
neg-mul-174.9%
+-commutative74.9%
unsub-neg74.9%
*-commutative74.9%
unpow274.9%
Simplified74.9%
if -3.69999999999999989e208 < z < 4.1e214Initial program 97.4%
+-commutative97.4%
fma-def97.4%
sub-neg97.4%
metadata-eval97.4%
sub-neg97.4%
log1p-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 96.5%
if 4.1e214 < z Initial program 46.0%
Taylor expanded in y around 0 100.0%
fma-def100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
unpow2100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in z around inf 82.6%
neg-mul-182.6%
+-commutative82.6%
unsub-neg82.6%
*-commutative82.6%
unpow282.6%
Simplified82.6%
Taylor expanded in y around 0 82.6%
neg-mul-182.6%
+-commutative82.6%
unsub-neg82.6%
mul-1-neg82.6%
Simplified82.6%
Final simplification93.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5e+15) (not (<= t 1000000000.0))) (- (* z (- (* -0.5 (* y y)) y)) t) (* (log y) (+ -1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5e+15) || !(t <= 1000000000.0)) {
tmp = (z * ((-0.5 * (y * y)) - y)) - t;
} else {
tmp = log(y) * (-1.0 + x);
}
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 <= (-5d+15)) .or. (.not. (t <= 1000000000.0d0))) then
tmp = (z * (((-0.5d0) * (y * y)) - y)) - t
else
tmp = log(y) * ((-1.0d0) + x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5e+15) || !(t <= 1000000000.0)) {
tmp = (z * ((-0.5 * (y * y)) - y)) - t;
} else {
tmp = Math.log(y) * (-1.0 + x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5e+15) or not (t <= 1000000000.0): tmp = (z * ((-0.5 * (y * y)) - y)) - t else: tmp = math.log(y) * (-1.0 + x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5e+15) || !(t <= 1000000000.0)) tmp = Float64(Float64(z * Float64(Float64(-0.5 * Float64(y * y)) - y)) - t); else tmp = Float64(log(y) * Float64(-1.0 + x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5e+15) || ~((t <= 1000000000.0))) tmp = (z * ((-0.5 * (y * y)) - y)) - t; else tmp = log(y) * (-1.0 + x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5e+15], N[Not[LessEqual[t, 1000000000.0]], $MachinePrecision]], N[(N[(z * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{+15} \lor \neg \left(t \leq 1000000000\right):\\
\;\;\;\;z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right)\\
\end{array}
\end{array}
if t < -5e15 or 1e9 < t Initial program 95.5%
Taylor expanded in y around 0 99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
unpow299.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 78.8%
neg-mul-178.8%
+-commutative78.8%
unsub-neg78.8%
*-commutative78.8%
unpow278.8%
Simplified78.8%
if -5e15 < t < 1e9Initial program 86.9%
+-commutative86.9%
fma-def86.9%
sub-neg86.9%
metadata-eval86.9%
sub-neg86.9%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 85.8%
Taylor expanded in t around 0 83.4%
Final simplification81.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.2e+204) (not (<= z 1.08e+89))) (- (* z (- (* -0.5 (* y y)) y)) t) (- (- (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.2e+204) || !(z <= 1.08e+89)) {
tmp = (z * ((-0.5 * (y * y)) - 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.2d+204)) .or. (.not. (z <= 1.08d+89))) then
tmp = (z * (((-0.5d0) * (y * y)) - 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.2e+204) || !(z <= 1.08e+89)) {
tmp = (z * ((-0.5 * (y * y)) - y)) - t;
} else {
tmp = -Math.log(y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.2e+204) or not (z <= 1.08e+89): tmp = (z * ((-0.5 * (y * y)) - y)) - t else: tmp = -math.log(y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.2e+204) || !(z <= 1.08e+89)) tmp = Float64(Float64(z * Float64(Float64(-0.5 * Float64(y * y)) - 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.2e+204) || ~((z <= 1.08e+89))) tmp = (z * ((-0.5 * (y * y)) - y)) - t; else tmp = -log(y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.2e+204], N[Not[LessEqual[z, 1.08e+89]], $MachinePrecision]], N[(N[(z * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+204} \lor \neg \left(z \leq 1.08 \cdot 10^{+89}\right):\\
\;\;\;\;z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-\log y\right) - t\\
\end{array}
\end{array}
if z < -1.2e204 or 1.08000000000000006e89 < z Initial program 66.0%
Taylor expanded in y around 0 99.8%
fma-def99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
unpow299.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 63.0%
neg-mul-163.0%
+-commutative63.0%
unsub-neg63.0%
*-commutative63.0%
unpow263.0%
Simplified63.0%
if -1.2e204 < z < 1.08000000000000006e89Initial program 99.4%
+-commutative99.4%
fma-def99.4%
sub-neg99.4%
metadata-eval99.4%
sub-neg99.4%
log1p-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 98.8%
Taylor expanded in x around 0 65.1%
mul-1-neg65.1%
Simplified65.1%
Final simplification64.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* -0.5 (* y y)) y)))
(if (<= t -6e-137)
(- (* (+ z -1.0) t_1) t)
(if (<= t 1950000.0) (- (log y)) (- (* z t_1) t)))))
double code(double x, double y, double z, double t) {
double t_1 = (-0.5 * (y * y)) - y;
double tmp;
if (t <= -6e-137) {
tmp = ((z + -1.0) * t_1) - t;
} else if (t <= 1950000.0) {
tmp = -log(y);
} else {
tmp = (z * t_1) - 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) :: t_1
real(8) :: tmp
t_1 = ((-0.5d0) * (y * y)) - y
if (t <= (-6d-137)) then
tmp = ((z + (-1.0d0)) * t_1) - t
else if (t <= 1950000.0d0) then
tmp = -log(y)
else
tmp = (z * t_1) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (-0.5 * (y * y)) - y;
double tmp;
if (t <= -6e-137) {
tmp = ((z + -1.0) * t_1) - t;
} else if (t <= 1950000.0) {
tmp = -Math.log(y);
} else {
tmp = (z * t_1) - t;
}
return tmp;
}
def code(x, y, z, t): t_1 = (-0.5 * (y * y)) - y tmp = 0 if t <= -6e-137: tmp = ((z + -1.0) * t_1) - t elif t <= 1950000.0: tmp = -math.log(y) else: tmp = (z * t_1) - t return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-0.5 * Float64(y * y)) - y) tmp = 0.0 if (t <= -6e-137) tmp = Float64(Float64(Float64(z + -1.0) * t_1) - t); elseif (t <= 1950000.0) tmp = Float64(-log(y)); else tmp = Float64(Float64(z * t_1) - t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (-0.5 * (y * y)) - y; tmp = 0.0; if (t <= -6e-137) tmp = ((z + -1.0) * t_1) - t; elseif (t <= 1950000.0) tmp = -log(y); else tmp = (z * t_1) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t, -6e-137], N[(N[(N[(z + -1.0), $MachinePrecision] * t$95$1), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t, 1950000.0], (-N[Log[y], $MachinePrecision]), N[(N[(z * t$95$1), $MachinePrecision] - t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -0.5 \cdot \left(y \cdot y\right) - y\\
\mathbf{if}\;t \leq -6 \cdot 10^{-137}:\\
\;\;\;\;\left(z + -1\right) \cdot t_1 - t\\
\mathbf{elif}\;t \leq 1950000:\\
\;\;\;\;-\log y\\
\mathbf{else}:\\
\;\;\;\;z \cdot t_1 - t\\
\end{array}
\end{array}
if t < -5.9999999999999996e-137Initial program 88.2%
Taylor expanded in y around 0 99.7%
fma-def99.7%
sub-neg99.7%
metadata-eval99.7%
+-commutative99.7%
unpow299.7%
sub-neg99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 57.7%
associate-*r*57.7%
neg-mul-157.7%
associate-*r*57.7%
distribute-rgt-out57.7%
sub-neg57.7%
metadata-eval57.7%
+-commutative57.7%
unsub-neg57.7%
*-commutative57.7%
unpow257.7%
Simplified57.7%
if -5.9999999999999996e-137 < t < 1.95e6Initial program 89.6%
+-commutative89.6%
fma-def89.6%
sub-neg89.6%
metadata-eval89.6%
sub-neg89.6%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 89.1%
Taylor expanded in x around 0 44.3%
mul-1-neg44.3%
Simplified44.3%
Taylor expanded in t around 0 44.4%
neg-mul-144.4%
Simplified44.4%
if 1.95e6 < t Initial program 97.4%
Taylor expanded in y around 0 100.0%
fma-def100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
unpow2100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in z around inf 81.5%
neg-mul-181.5%
+-commutative81.5%
unsub-neg81.5%
*-commutative81.5%
unpow281.5%
Simplified81.5%
Final simplification58.9%
(FPCore (x y z t) :precision binary64 (- (* (+ z -1.0) (- (* -0.5 (* y y)) y)) t))
double code(double x, double y, double z, double t) {
return ((z + -1.0) * ((-0.5 * (y * y)) - 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 + (-1.0d0)) * (((-0.5d0) * (y * y)) - y)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((z + -1.0) * ((-0.5 * (y * y)) - y)) - t;
}
def code(x, y, z, t): return ((z + -1.0) * ((-0.5 * (y * y)) - y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(z + -1.0) * Float64(Float64(-0.5 * Float64(y * y)) - y)) - t) end
function tmp = code(x, y, z, t) tmp = ((z + -1.0) * ((-0.5 * (y * y)) - y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(z + -1.0), $MachinePrecision] * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(z + -1\right) \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 99.8%
fma-def99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
unpow299.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around inf 47.2%
associate-*r*47.2%
neg-mul-147.2%
associate-*r*47.2%
distribute-rgt-out47.2%
sub-neg47.2%
metadata-eval47.2%
+-commutative47.2%
unsub-neg47.2%
*-commutative47.2%
unpow247.2%
Simplified47.2%
Final simplification47.2%
(FPCore (x y z t) :precision binary64 (- (* z (- (* -0.5 (* y y)) y)) t))
double code(double x, double y, double z, double t) {
return (z * ((-0.5 * (y * y)) - 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 * (((-0.5d0) * (y * y)) - y)) - t
end function
public static double code(double x, double y, double z, double t) {
return (z * ((-0.5 * (y * y)) - y)) - t;
}
def code(x, y, z, t): return (z * ((-0.5 * (y * y)) - y)) - t
function code(x, y, z, t) return Float64(Float64(z * Float64(Float64(-0.5 * Float64(y * y)) - y)) - t) end
function tmp = code(x, y, z, t) tmp = (z * ((-0.5 * (y * y)) - y)) - t; end
code[x_, y_, z_, t_] := N[(N[(z * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t
\end{array}
Initial program 91.1%
Taylor expanded in y around 0 99.8%
fma-def99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
unpow299.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 47.0%
neg-mul-147.0%
+-commutative47.0%
unsub-neg47.0%
*-commutative47.0%
unpow247.0%
Simplified47.0%
Final simplification47.0%
(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 91.1%
Taylor expanded in y around 0 99.8%
fma-def99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
unpow299.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 47.0%
neg-mul-147.0%
+-commutative47.0%
unsub-neg47.0%
*-commutative47.0%
unpow247.0%
Simplified47.0%
Taylor expanded in y around 0 46.8%
neg-mul-146.8%
+-commutative46.8%
unsub-neg46.8%
mul-1-neg46.8%
Simplified46.8%
Final simplification46.8%
(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 91.1%
+-commutative91.1%
fma-def91.1%
sub-neg91.1%
metadata-eval91.1%
sub-neg91.1%
log1p-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 38.0%
neg-mul-138.0%
Simplified38.0%
Final simplification38.0%
herbie shell --seed 2023297
(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))