
(FPCore (x y z t) :precision binary64 (- (+ (* x (log y)) (* z (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return ((x * log(y)) + (z * 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 * log(y)) + (z * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x * Math.log(y)) + (z * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return ((x * math.log(y)) + (z * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(x * log(y)) + Float64(z * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) + (z * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log y + z \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 (log y)) (* z (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return ((x * log(y)) + (z * 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 * log(y)) + (z * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x * Math.log(y)) + (z * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return ((x * math.log(y)) + (z * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(x * log(y)) + Float64(z * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) + (z * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\end{array}
(FPCore (x y z t) :precision binary64 (fma x (log y) (fma z (log1p (- y)) (- t))))
double code(double x, double y, double z, double t) {
return fma(x, log(y), fma(z, log1p(-y), -t));
}
function code(x, y, z, t) return fma(x, log(y), fma(z, log1p(Float64(-y)), Float64(-t))) end
code[x_, y_, z_, t_] := N[(x * N[Log[y], $MachinePrecision] + N[(z * N[Log[1 + (-y)], $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, \log y, \mathsf{fma}\left(z, \mathsf{log1p}\left(-y\right), -t\right)\right)
\end{array}
Initial program 83.8%
associate--l+83.8%
fma-def83.8%
fma-neg83.8%
sub-neg83.8%
log1p-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (fma z (log1p (- y)) (* x (log y))) t))
double code(double x, double y, double z, double t) {
return fma(z, log1p(-y), (x * log(y))) - t;
}
function code(x, y, z, t) return Float64(fma(z, log1p(Float64(-y)), Float64(x * log(y))) - t) end
code[x_, y_, z_, t_] := N[(N[(z * N[Log[1 + (-y)], $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, \mathsf{log1p}\left(-y\right), x \cdot \log y\right) - t
\end{array}
Initial program 83.8%
+-commutative83.8%
fma-def83.8%
sub-neg83.8%
log1p-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (fma x (log y) (- (- t) (* y z))))
double code(double x, double y, double z, double t) {
return fma(x, log(y), (-t - (y * z)));
}
function code(x, y, z, t) return fma(x, log(y), Float64(Float64(-t) - Float64(y * z))) end
code[x_, y_, z_, t_] := N[(x * N[Log[y], $MachinePrecision] + N[((-t) - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, \log y, \left(-t\right) - y \cdot z\right)
\end{array}
Initial program 83.8%
associate--l+83.8%
fma-def83.8%
fma-neg83.8%
sub-neg83.8%
log1p-def99.8%
Simplified99.8%
Taylor expanded in y around 0 99.6%
mul-1-neg99.6%
+-commutative99.6%
unsub-neg99.6%
mul-1-neg99.6%
distribute-rgt-neg-in99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (log y)))) (if (or (<= t -3.2e-8) (not (<= t 8e-78))) (- t_1 t) (- t_1 (* y z)))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if ((t <= -3.2e-8) || !(t <= 8e-78)) {
tmp = t_1 - t;
} else {
tmp = t_1 - (y * 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) :: t_1
real(8) :: tmp
t_1 = x * log(y)
if ((t <= (-3.2d-8)) .or. (.not. (t <= 8d-78))) then
tmp = t_1 - t
else
tmp = t_1 - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * Math.log(y);
double tmp;
if ((t <= -3.2e-8) || !(t <= 8e-78)) {
tmp = t_1 - t;
} else {
tmp = t_1 - (y * z);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if (t <= -3.2e-8) or not (t <= 8e-78): tmp = t_1 - t else: tmp = t_1 - (y * z) return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if ((t <= -3.2e-8) || !(t <= 8e-78)) tmp = Float64(t_1 - t); else tmp = Float64(t_1 - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if ((t <= -3.2e-8) || ~((t <= 8e-78))) tmp = t_1 - t; else tmp = t_1 - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t, -3.2e-8], N[Not[LessEqual[t, 8e-78]], $MachinePrecision]], N[(t$95$1 - t), $MachinePrecision], N[(t$95$1 - N[(y * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;t \leq -3.2 \cdot 10^{-8} \lor \neg \left(t \leq 8 \cdot 10^{-78}\right):\\
\;\;\;\;t_1 - t\\
\mathbf{else}:\\
\;\;\;\;t_1 - y \cdot z\\
\end{array}
\end{array}
if t < -3.2000000000000002e-8 or 7.99999999999999999e-78 < t Initial program 94.4%
+-commutative94.4%
fma-def94.4%
sub-neg94.4%
log1p-def99.8%
Simplified99.8%
Taylor expanded in z around 0 93.6%
if -3.2000000000000002e-8 < t < 7.99999999999999999e-78Initial program 70.2%
associate--l+70.2%
fma-def70.2%
fma-neg70.2%
sub-neg70.2%
log1p-def99.8%
Simplified99.8%
Taylor expanded in y around 0 99.8%
mul-1-neg99.8%
+-commutative99.8%
unsub-neg99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
Simplified99.8%
Taylor expanded in t around 0 91.7%
+-commutative91.7%
mul-1-neg91.7%
unsub-neg91.7%
Simplified91.7%
Final simplification92.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.3e-8) (not (<= t 8.6e-78))) (- (/ x (/ 1.0 (log y))) t) (- (* x (log y)) (* y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.3e-8) || !(t <= 8.6e-78)) {
tmp = (x / (1.0 / log(y))) - t;
} else {
tmp = (x * log(y)) - (y * 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 <= (-3.3d-8)) .or. (.not. (t <= 8.6d-78))) then
tmp = (x / (1.0d0 / log(y))) - t
else
tmp = (x * log(y)) - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.3e-8) || !(t <= 8.6e-78)) {
tmp = (x / (1.0 / Math.log(y))) - t;
} else {
tmp = (x * Math.log(y)) - (y * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.3e-8) or not (t <= 8.6e-78): tmp = (x / (1.0 / math.log(y))) - t else: tmp = (x * math.log(y)) - (y * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.3e-8) || !(t <= 8.6e-78)) tmp = Float64(Float64(x / Float64(1.0 / log(y))) - t); else tmp = Float64(Float64(x * log(y)) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3.3e-8) || ~((t <= 8.6e-78))) tmp = (x / (1.0 / log(y))) - t; else tmp = (x * log(y)) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.3e-8], N[Not[LessEqual[t, 8.6e-78]], $MachinePrecision]], N[(N[(x / N[(1.0 / N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.3 \cdot 10^{-8} \lor \neg \left(t \leq 8.6 \cdot 10^{-78}\right):\\
\;\;\;\;\frac{x}{\frac{1}{\log y}} - t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \log y - y \cdot z\\
\end{array}
\end{array}
if t < -3.29999999999999977e-8 or 8.59999999999999987e-78 < t Initial program 94.4%
+-commutative94.4%
fma-def94.4%
sub-neg94.4%
log1p-def99.8%
Simplified99.8%
Taylor expanded in z around 0 93.6%
add-log-exp52.9%
*-commutative52.9%
exp-to-pow52.9%
Applied egg-rr52.9%
log-pow93.6%
/-rgt-identity93.6%
associate-/l*93.6%
Applied egg-rr93.6%
if -3.29999999999999977e-8 < t < 8.59999999999999987e-78Initial program 70.2%
associate--l+70.2%
fma-def70.2%
fma-neg70.2%
sub-neg70.2%
log1p-def99.8%
Simplified99.8%
Taylor expanded in y around 0 99.8%
mul-1-neg99.8%
+-commutative99.8%
unsub-neg99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
Simplified99.8%
Taylor expanded in t around 0 91.7%
+-commutative91.7%
mul-1-neg91.7%
unsub-neg91.7%
Simplified91.7%
Final simplification92.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.2e-8) (not (<= t 1.8e-77))) (- (/ (log y) (/ 1.0 x)) t) (- (* x (log y)) (* y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.2e-8) || !(t <= 1.8e-77)) {
tmp = (log(y) / (1.0 / x)) - t;
} else {
tmp = (x * log(y)) - (y * 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 <= (-3.2d-8)) .or. (.not. (t <= 1.8d-77))) then
tmp = (log(y) / (1.0d0 / x)) - t
else
tmp = (x * log(y)) - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.2e-8) || !(t <= 1.8e-77)) {
tmp = (Math.log(y) / (1.0 / x)) - t;
} else {
tmp = (x * Math.log(y)) - (y * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.2e-8) or not (t <= 1.8e-77): tmp = (math.log(y) / (1.0 / x)) - t else: tmp = (x * math.log(y)) - (y * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.2e-8) || !(t <= 1.8e-77)) tmp = Float64(Float64(log(y) / Float64(1.0 / x)) - t); else tmp = Float64(Float64(x * log(y)) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3.2e-8) || ~((t <= 1.8e-77))) tmp = (log(y) / (1.0 / x)) - t; else tmp = (x * log(y)) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.2e-8], N[Not[LessEqual[t, 1.8e-77]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] / N[(1.0 / x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{-8} \lor \neg \left(t \leq 1.8 \cdot 10^{-77}\right):\\
\;\;\;\;\frac{\log y}{\frac{1}{x}} - t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \log y - y \cdot z\\
\end{array}
\end{array}
if t < -3.2000000000000002e-8 or 1.8e-77 < t Initial program 94.4%
+-commutative94.4%
fma-def94.4%
sub-neg94.4%
log1p-def99.8%
Simplified99.8%
Taylor expanded in z around 0 93.6%
add-log-exp52.9%
*-commutative52.9%
exp-to-pow52.9%
Applied egg-rr52.9%
log-pow93.6%
/-rgt-identity93.6%
*-commutative93.6%
associate-/l*93.6%
Applied egg-rr93.6%
if -3.2000000000000002e-8 < t < 1.8e-77Initial program 70.2%
associate--l+70.2%
fma-def70.2%
fma-neg70.2%
sub-neg70.2%
log1p-def99.8%
Simplified99.8%
Taylor expanded in y around 0 99.8%
mul-1-neg99.8%
+-commutative99.8%
unsub-neg99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
Simplified99.8%
Taylor expanded in t around 0 91.7%
+-commutative91.7%
mul-1-neg91.7%
unsub-neg91.7%
Simplified91.7%
Final simplification92.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.4e-129) (not (<= x 2.9e-46))) (- (* x (log y)) t) (- (* z (log1p (- y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.4e-129) || !(x <= 2.9e-46)) {
tmp = (x * log(y)) - t;
} else {
tmp = (z * log1p(-y)) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.4e-129) || !(x <= 2.9e-46)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = (z * Math.log1p(-y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.4e-129) or not (x <= 2.9e-46): tmp = (x * math.log(y)) - t else: tmp = (z * math.log1p(-y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.4e-129) || !(x <= 2.9e-46)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(z * log1p(Float64(-y))) - t); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.4e-129], N[Not[LessEqual[x, 2.9e-46]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{-129} \lor \neg \left(x \leq 2.9 \cdot 10^{-46}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\end{array}
\end{array}
if x < -2.39999999999999989e-129 or 2.90000000000000005e-46 < x Initial program 93.9%
+-commutative93.9%
fma-def93.9%
sub-neg93.9%
log1p-def99.7%
Simplified99.7%
Taylor expanded in z around 0 93.6%
if -2.39999999999999989e-129 < x < 2.90000000000000005e-46Initial program 68.9%
Taylor expanded in x around 0 60.4%
sub-neg60.4%
mul-1-neg60.4%
log1p-def91.5%
mul-1-neg91.5%
Simplified91.5%
Final simplification92.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5e-134) (not (<= x 6.6e-44))) (- (* x (log y)) t) (- (- t) (* y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5e-134) || !(x <= 6.6e-44)) {
tmp = (x * log(y)) - t;
} else {
tmp = -t - (y * 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 ((x <= (-5d-134)) .or. (.not. (x <= 6.6d-44))) then
tmp = (x * log(y)) - t
else
tmp = -t - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5e-134) || !(x <= 6.6e-44)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = -t - (y * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5e-134) or not (x <= 6.6e-44): tmp = (x * math.log(y)) - t else: tmp = -t - (y * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5e-134) || !(x <= 6.6e-44)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(-t) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -5e-134) || ~((x <= 6.6e-44))) tmp = (x * log(y)) - t; else tmp = -t - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5e-134], N[Not[LessEqual[x, 6.6e-44]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-134} \lor \neg \left(x \leq 6.6 \cdot 10^{-44}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - y \cdot z\\
\end{array}
\end{array}
if x < -5.0000000000000003e-134 or 6.60000000000000011e-44 < x Initial program 93.9%
+-commutative93.9%
fma-def93.9%
sub-neg93.9%
log1p-def99.7%
Simplified99.7%
Taylor expanded in z around 0 93.6%
if -5.0000000000000003e-134 < x < 6.60000000000000011e-44Initial program 68.9%
associate--l+68.9%
fma-def68.9%
fma-neg68.9%
sub-neg68.9%
log1p-def100.0%
Simplified100.0%
Taylor expanded in y around 0 99.5%
mul-1-neg99.5%
+-commutative99.5%
unsub-neg99.5%
mul-1-neg99.5%
distribute-rgt-neg-in99.5%
Simplified99.5%
Taylor expanded in x around 0 91.1%
associate-*r*91.1%
neg-mul-191.1%
Simplified91.1%
Final simplification92.6%
(FPCore (x y z t) :precision binary64 (- (- (* x (log y)) (* y z)) t))
double code(double x, double y, double z, double t) {
return ((x * 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 * log(y)) - (y * z)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x * Math.log(y)) - (y * z)) - t;
}
def code(x, y, z, t): return ((x * math.log(y)) - (y * z)) - t
function code(x, y, z, t) return Float64(Float64(Float64(x * log(y)) - Float64(y * z)) - t) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) - (y * z)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log y - y \cdot z\right) - t
\end{array}
Initial program 83.8%
Taylor expanded in y around 0 99.6%
log-pow49.8%
+-commutative49.8%
mul-1-neg49.8%
unsub-neg49.8%
log-pow99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.8e+124) (not (<= x 3.3e+105))) (* x (log y)) (- (- t) (* y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.8e+124) || !(x <= 3.3e+105)) {
tmp = x * log(y);
} else {
tmp = -t - (y * 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 ((x <= (-5.8d+124)) .or. (.not. (x <= 3.3d+105))) then
tmp = x * log(y)
else
tmp = -t - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.8e+124) || !(x <= 3.3e+105)) {
tmp = x * Math.log(y);
} else {
tmp = -t - (y * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5.8e+124) or not (x <= 3.3e+105): tmp = x * math.log(y) else: tmp = -t - (y * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5.8e+124) || !(x <= 3.3e+105)) tmp = Float64(x * log(y)); else tmp = Float64(Float64(-t) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -5.8e+124) || ~((x <= 3.3e+105))) tmp = x * log(y); else tmp = -t - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5.8e+124], N[Not[LessEqual[x, 3.3e+105]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[((-t) - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{+124} \lor \neg \left(x \leq 3.3 \cdot 10^{+105}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - y \cdot z\\
\end{array}
\end{array}
if x < -5.80000000000000043e124 or 3.29999999999999997e105 < x Initial program 99.6%
associate--l+99.6%
fma-def99.6%
fma-neg99.6%
sub-neg99.6%
log1p-def99.6%
Simplified99.6%
Taylor expanded in y around 0 99.6%
mul-1-neg99.6%
+-commutative99.6%
unsub-neg99.6%
mul-1-neg99.6%
distribute-rgt-neg-in99.6%
Simplified99.6%
Taylor expanded in x around inf 87.1%
if -5.80000000000000043e124 < x < 3.29999999999999997e105Initial program 76.4%
associate--l+76.4%
fma-def76.4%
fma-neg76.4%
sub-neg76.4%
log1p-def99.9%
Simplified99.9%
Taylor expanded in y around 0 99.5%
mul-1-neg99.5%
+-commutative99.5%
unsub-neg99.5%
mul-1-neg99.5%
distribute-rgt-neg-in99.5%
Simplified99.5%
Taylor expanded in x around 0 79.3%
associate-*r*79.3%
neg-mul-179.3%
Simplified79.3%
Final simplification81.8%
(FPCore (x y z t) :precision binary64 (if (<= t -6e-8) (- t) (if (<= t 3e-78) (* y (- z)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6e-8) {
tmp = -t;
} else if (t <= 3e-78) {
tmp = y * -z;
} else {
tmp = -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 (t <= (-6d-8)) then
tmp = -t
else if (t <= 3d-78) then
tmp = y * -z
else
tmp = -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6e-8) {
tmp = -t;
} else if (t <= 3e-78) {
tmp = y * -z;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -6e-8: tmp = -t elif t <= 3e-78: tmp = y * -z else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -6e-8) tmp = Float64(-t); elseif (t <= 3e-78) tmp = Float64(y * Float64(-z)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -6e-8) tmp = -t; elseif (t <= 3e-78) tmp = y * -z; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -6e-8], (-t), If[LessEqual[t, 3e-78], N[(y * (-z)), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6 \cdot 10^{-8}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 3 \cdot 10^{-78}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -5.99999999999999946e-8 or 2.99999999999999988e-78 < t Initial program 94.4%
+-commutative94.4%
fma-def94.4%
sub-neg94.4%
log1p-def99.8%
Simplified99.8%
Taylor expanded in t around inf 67.5%
mul-1-neg67.5%
Simplified67.5%
if -5.99999999999999946e-8 < t < 2.99999999999999988e-78Initial program 70.2%
associate--l+70.2%
fma-def70.2%
fma-neg70.2%
sub-neg70.2%
log1p-def99.8%
Simplified99.8%
Taylor expanded in y around 0 99.8%
mul-1-neg99.8%
+-commutative99.8%
unsub-neg99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
Simplified99.8%
Taylor expanded in y around inf 31.8%
associate-*r*31.8%
neg-mul-131.8%
Simplified31.8%
Final simplification51.9%
(FPCore (x y z t) :precision binary64 (- (- t) (* y z)))
double code(double x, double y, double z, double t) {
return -t - (y * z);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -t - (y * z)
end function
public static double code(double x, double y, double z, double t) {
return -t - (y * z);
}
def code(x, y, z, t): return -t - (y * z)
function code(x, y, z, t) return Float64(Float64(-t) - Float64(y * z)) end
function tmp = code(x, y, z, t) tmp = -t - (y * z); end
code[x_, y_, z_, t_] := N[((-t) - N[(y * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-t\right) - y \cdot z
\end{array}
Initial program 83.8%
associate--l+83.8%
fma-def83.8%
fma-neg83.8%
sub-neg83.8%
log1p-def99.8%
Simplified99.8%
Taylor expanded in y around 0 99.6%
mul-1-neg99.6%
+-commutative99.6%
unsub-neg99.6%
mul-1-neg99.6%
distribute-rgt-neg-in99.6%
Simplified99.6%
Taylor expanded in x around 0 58.2%
associate-*r*58.2%
neg-mul-158.2%
Simplified58.2%
Final simplification58.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 83.8%
+-commutative83.8%
fma-def83.8%
sub-neg83.8%
log1p-def99.8%
Simplified99.8%
Taylor expanded in t around inf 42.6%
mul-1-neg42.6%
Simplified42.6%
Final simplification42.6%
(FPCore (x y z t)
:precision binary64
(-
(*
(- z)
(+
(+ (* 0.5 (* y y)) y)
(* (/ 0.3333333333333333 (* 1.0 (* 1.0 1.0))) (* y (* y y)))))
(- t (* x (log y)))))
double code(double x, double y, double z, double t) {
return (-z * (((0.5 * (y * y)) + y) + ((0.3333333333333333 / (1.0 * (1.0 * 1.0))) * (y * (y * y))))) - (t - (x * log(y)));
}
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) + ((0.3333333333333333d0 / (1.0d0 * (1.0d0 * 1.0d0))) * (y * (y * y))))) - (t - (x * log(y)))
end function
public static double code(double x, double y, double z, double t) {
return (-z * (((0.5 * (y * y)) + y) + ((0.3333333333333333 / (1.0 * (1.0 * 1.0))) * (y * (y * y))))) - (t - (x * Math.log(y)));
}
def code(x, y, z, t): return (-z * (((0.5 * (y * y)) + y) + ((0.3333333333333333 / (1.0 * (1.0 * 1.0))) * (y * (y * y))))) - (t - (x * math.log(y)))
function code(x, y, z, t) return Float64(Float64(Float64(-z) * Float64(Float64(Float64(0.5 * Float64(y * y)) + y) + Float64(Float64(0.3333333333333333 / Float64(1.0 * Float64(1.0 * 1.0))) * Float64(y * Float64(y * y))))) - Float64(t - Float64(x * log(y)))) end
function tmp = code(x, y, z, t) tmp = (-z * (((0.5 * (y * y)) + y) + ((0.3333333333333333 / (1.0 * (1.0 * 1.0))) * (y * (y * y))))) - (t - (x * log(y))); end
code[x_, y_, z_, t_] := N[(N[((-z) * N[(N[(N[(0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] + N[(N[(0.3333333333333333 / N[(1.0 * N[(1.0 * 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t - N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-z\right) \cdot \left(\left(0.5 \cdot \left(y \cdot y\right) + y\right) + \frac{0.3333333333333333}{1 \cdot \left(1 \cdot 1\right)} \cdot \left(y \cdot \left(y \cdot y\right)\right)\right) - \left(t - x \cdot \log y\right)
\end{array}
herbie shell --seed 2023275
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, B"
:precision binary64
:herbie-target
(- (* (- z) (+ (+ (* 0.5 (* y y)) y) (* (/ 0.3333333333333333 (* 1.0 (* 1.0 1.0))) (* y (* y y))))) (- t (* x (log y))))
(- (+ (* x (log y)) (* z (log (- 1.0 y)))) t))