
(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 12 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 85.2%
associate--l+85.2%
fma-def85.2%
fma-neg85.2%
sub-neg85.2%
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 85.2%
+-commutative85.2%
fma-def85.2%
sub-neg85.2%
log1p-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (fma (- y) z (fma x (log y) (- t))))
double code(double x, double y, double z, double t) {
return fma(-y, z, fma(x, log(y), -t));
}
function code(x, y, z, t) return fma(Float64(-y), z, fma(x, log(y), Float64(-t))) end
code[x_, y_, z_, t_] := N[((-y) * z + N[(x * N[Log[y], $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-y, z, \mathsf{fma}\left(x, \log y, -t\right)\right)
\end{array}
Initial program 85.2%
Taylor expanded in y around 0 99.2%
associate--l+99.2%
associate-*r*99.2%
fma-def99.2%
mul-1-neg99.2%
fma-neg99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= x -2.25e+74)
t_1
(if (<= x -1.9e-54)
(- (- t) (* y z))
(if (or (<= x -1e-78) (not (<= x 0.036)))
t_1
(- (* (* y z) (+ (* y -0.5) -1.0)) t))))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (x <= -2.25e+74) {
tmp = t_1;
} else if (x <= -1.9e-54) {
tmp = -t - (y * z);
} else if ((x <= -1e-78) || !(x <= 0.036)) {
tmp = t_1;
} else {
tmp = ((y * z) * ((y * -0.5) + -1.0)) - 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 = x * log(y)
if (x <= (-2.25d+74)) then
tmp = t_1
else if (x <= (-1.9d-54)) then
tmp = -t - (y * z)
else if ((x <= (-1d-78)) .or. (.not. (x <= 0.036d0))) then
tmp = t_1
else
tmp = ((y * z) * ((y * (-0.5d0)) + (-1.0d0))) - t
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 (x <= -2.25e+74) {
tmp = t_1;
} else if (x <= -1.9e-54) {
tmp = -t - (y * z);
} else if ((x <= -1e-78) || !(x <= 0.036)) {
tmp = t_1;
} else {
tmp = ((y * z) * ((y * -0.5) + -1.0)) - t;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if x <= -2.25e+74: tmp = t_1 elif x <= -1.9e-54: tmp = -t - (y * z) elif (x <= -1e-78) or not (x <= 0.036): tmp = t_1 else: tmp = ((y * z) * ((y * -0.5) + -1.0)) - t return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if (x <= -2.25e+74) tmp = t_1; elseif (x <= -1.9e-54) tmp = Float64(Float64(-t) - Float64(y * z)); elseif ((x <= -1e-78) || !(x <= 0.036)) tmp = t_1; else tmp = Float64(Float64(Float64(y * z) * Float64(Float64(y * -0.5) + -1.0)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if (x <= -2.25e+74) tmp = t_1; elseif (x <= -1.9e-54) tmp = -t - (y * z); elseif ((x <= -1e-78) || ~((x <= 0.036))) tmp = t_1; else tmp = ((y * z) * ((y * -0.5) + -1.0)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.25e+74], t$95$1, If[LessEqual[x, -1.9e-54], N[((-t) - N[(y * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -1e-78], N[Not[LessEqual[x, 0.036]], $MachinePrecision]], t$95$1, N[(N[(N[(y * z), $MachinePrecision] * N[(N[(y * -0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -2.25 \cdot 10^{+74}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.9 \cdot 10^{-54}:\\
\;\;\;\;\left(-t\right) - y \cdot z\\
\mathbf{elif}\;x \leq -1 \cdot 10^{-78} \lor \neg \left(x \leq 0.036\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot z\right) \cdot \left(y \cdot -0.5 + -1\right) - t\\
\end{array}
\end{array}
if x < -2.25e74 or -1.9000000000000001e-54 < x < -9.99999999999999999e-79 or 0.0359999999999999973 < x Initial program 97.6%
Taylor expanded in y around 0 99.1%
+-commutative99.1%
mul-1-neg99.1%
unsub-neg99.1%
associate-*r*99.1%
associate-*r*99.1%
distribute-rgt-out99.1%
+-commutative99.1%
fma-def99.1%
*-commutative99.1%
unpow299.1%
associate-*l*99.1%
Simplified99.1%
Taylor expanded in x around inf 76.6%
if -2.25e74 < x < -1.9000000000000001e-54Initial program 73.2%
Taylor expanded in x around 0 46.8%
sub-neg46.8%
mul-1-neg46.8%
log1p-def73.2%
mul-1-neg73.2%
Simplified73.2%
Taylor expanded in y around 0 73.2%
distribute-lft-out73.2%
*-commutative73.2%
Simplified73.2%
if -9.99999999999999999e-79 < x < 0.0359999999999999973Initial program 74.1%
Taylor expanded in x around 0 66.1%
sub-neg66.1%
mul-1-neg66.1%
log1p-def92.0%
mul-1-neg92.0%
Simplified92.0%
Taylor expanded in y around 0 91.9%
mul-1-neg91.9%
+-commutative91.9%
unsub-neg91.9%
+-commutative91.9%
*-commutative91.9%
*-commutative91.9%
unpow291.9%
associate-*r*91.9%
*-commutative91.9%
associate-*r*91.9%
*-commutative91.9%
distribute-lft-out91.9%
*-commutative91.9%
*-commutative91.9%
Simplified91.9%
Final simplification82.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= x -6.1e+76)
t_1
(if (<= x -1.9e-54)
(- (fma z y t))
(if (or (<= x -1e-78) (not (<= x 0.036)))
t_1
(- (* (* y z) (+ (* y -0.5) -1.0)) t))))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (x <= -6.1e+76) {
tmp = t_1;
} else if (x <= -1.9e-54) {
tmp = -fma(z, y, t);
} else if ((x <= -1e-78) || !(x <= 0.036)) {
tmp = t_1;
} else {
tmp = ((y * z) * ((y * -0.5) + -1.0)) - t;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if (x <= -6.1e+76) tmp = t_1; elseif (x <= -1.9e-54) tmp = Float64(-fma(z, y, t)); elseif ((x <= -1e-78) || !(x <= 0.036)) tmp = t_1; else tmp = Float64(Float64(Float64(y * z) * Float64(Float64(y * -0.5) + -1.0)) - t); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.1e+76], t$95$1, If[LessEqual[x, -1.9e-54], (-N[(z * y + t), $MachinePrecision]), If[Or[LessEqual[x, -1e-78], N[Not[LessEqual[x, 0.036]], $MachinePrecision]], t$95$1, N[(N[(N[(y * z), $MachinePrecision] * N[(N[(y * -0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -6.1 \cdot 10^{+76}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.9 \cdot 10^{-54}:\\
\;\;\;\;-\mathsf{fma}\left(z, y, t\right)\\
\mathbf{elif}\;x \leq -1 \cdot 10^{-78} \lor \neg \left(x \leq 0.036\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot z\right) \cdot \left(y \cdot -0.5 + -1\right) - t\\
\end{array}
\end{array}
if x < -6.10000000000000058e76 or -1.9000000000000001e-54 < x < -9.99999999999999999e-79 or 0.0359999999999999973 < x Initial program 97.6%
Taylor expanded in y around 0 99.1%
+-commutative99.1%
mul-1-neg99.1%
unsub-neg99.1%
associate-*r*99.1%
associate-*r*99.1%
distribute-rgt-out99.1%
+-commutative99.1%
fma-def99.1%
*-commutative99.1%
unpow299.1%
associate-*l*99.1%
Simplified99.1%
Taylor expanded in x around inf 76.6%
if -6.10000000000000058e76 < x < -1.9000000000000001e-54Initial program 73.2%
Taylor expanded in x around 0 46.8%
sub-neg46.8%
mul-1-neg46.8%
log1p-def73.2%
mul-1-neg73.2%
Simplified73.2%
Taylor expanded in y around 0 73.2%
distribute-lft-out73.2%
neg-mul-173.2%
+-commutative73.2%
*-commutative73.2%
fma-def73.3%
Simplified73.3%
if -9.99999999999999999e-79 < x < 0.0359999999999999973Initial program 74.1%
Taylor expanded in x around 0 66.1%
sub-neg66.1%
mul-1-neg66.1%
log1p-def92.0%
mul-1-neg92.0%
Simplified92.0%
Taylor expanded in y around 0 91.9%
mul-1-neg91.9%
+-commutative91.9%
unsub-neg91.9%
+-commutative91.9%
*-commutative91.9%
*-commutative91.9%
unpow291.9%
associate-*r*91.9%
*-commutative91.9%
associate-*r*91.9%
*-commutative91.9%
distribute-lft-out91.9%
*-commutative91.9%
*-commutative91.9%
Simplified91.9%
Final simplification82.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.7e-81) (not (<= x 6.6e-58))) (- (* x (log y)) t) (- (* z (log1p (- y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.7e-81) || !(x <= 6.6e-58)) {
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.7e-81) || !(x <= 6.6e-58)) {
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.7e-81) or not (x <= 6.6e-58): 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.7e-81) || !(x <= 6.6e-58)) 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.7e-81], N[Not[LessEqual[x, 6.6e-58]], $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.7 \cdot 10^{-81} \lor \neg \left(x \leq 6.6 \cdot 10^{-58}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\end{array}
\end{array}
if x < -2.6999999999999999e-81 or 6.60000000000000052e-58 < x Initial program 92.7%
Taylor expanded in y around 0 92.2%
if -2.6999999999999999e-81 < x < 6.60000000000000052e-58Initial program 72.1%
Taylor expanded in x around 0 66.9%
sub-neg66.9%
mul-1-neg66.9%
log1p-def94.8%
mul-1-neg94.8%
Simplified94.8%
Final simplification93.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.2e-84) (not (<= x 9.2e-58))) (- (* x (log y)) t) (- (* (* y z) (+ (* y -0.5) -1.0)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.2e-84) || !(x <= 9.2e-58)) {
tmp = (x * log(y)) - t;
} else {
tmp = ((y * z) * ((y * -0.5) + -1.0)) - 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 <= (-3.2d-84)) .or. (.not. (x <= 9.2d-58))) then
tmp = (x * log(y)) - t
else
tmp = ((y * z) * ((y * (-0.5d0)) + (-1.0d0))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.2e-84) || !(x <= 9.2e-58)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = ((y * z) * ((y * -0.5) + -1.0)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.2e-84) or not (x <= 9.2e-58): tmp = (x * math.log(y)) - t else: tmp = ((y * z) * ((y * -0.5) + -1.0)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.2e-84) || !(x <= 9.2e-58)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(Float64(y * z) * Float64(Float64(y * -0.5) + -1.0)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.2e-84) || ~((x <= 9.2e-58))) tmp = (x * log(y)) - t; else tmp = ((y * z) * ((y * -0.5) + -1.0)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.2e-84], N[Not[LessEqual[x, 9.2e-58]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(y * z), $MachinePrecision] * N[(N[(y * -0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-84} \lor \neg \left(x \leq 9.2 \cdot 10^{-58}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot z\right) \cdot \left(y \cdot -0.5 + -1\right) - t\\
\end{array}
\end{array}
if x < -3.1999999999999999e-84 or 9.1999999999999995e-58 < x Initial program 92.7%
Taylor expanded in y around 0 92.2%
if -3.1999999999999999e-84 < x < 9.1999999999999995e-58Initial program 72.1%
Taylor expanded in x around 0 66.9%
sub-neg66.9%
mul-1-neg66.9%
log1p-def94.8%
mul-1-neg94.8%
Simplified94.8%
Taylor expanded in y around 0 94.7%
mul-1-neg94.7%
+-commutative94.7%
unsub-neg94.7%
+-commutative94.7%
*-commutative94.7%
*-commutative94.7%
unpow294.7%
associate-*r*94.7%
*-commutative94.7%
associate-*r*94.7%
*-commutative94.7%
distribute-lft-out94.7%
*-commutative94.7%
*-commutative94.7%
Simplified94.7%
Final simplification93.1%
(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 85.2%
+-commutative85.2%
fma-def85.2%
sub-neg85.2%
log1p-def99.8%
Simplified99.8%
Taylor expanded in y around 0 99.2%
+-commutative99.2%
mul-1-neg99.2%
unsub-neg99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t) :precision binary64 (- (* (* y z) (+ (* y -0.5) -1.0)) t))
double code(double x, double y, double z, double t) {
return ((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 = ((y * z) * ((y * (-0.5d0)) + (-1.0d0))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((y * z) * ((y * -0.5) + -1.0)) - t;
}
def code(x, y, z, t): return ((y * z) * ((y * -0.5) + -1.0)) - t
function code(x, y, z, t) return Float64(Float64(Float64(y * z) * Float64(Float64(y * -0.5) + -1.0)) - t) end
function tmp = code(x, y, z, t) tmp = ((y * z) * ((y * -0.5) + -1.0)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(y * z), $MachinePrecision] * N[(N[(y * -0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(y \cdot z\right) \cdot \left(y \cdot -0.5 + -1\right) - t
\end{array}
Initial program 85.2%
Taylor expanded in x around 0 43.4%
sub-neg43.4%
mul-1-neg43.4%
log1p-def57.9%
mul-1-neg57.9%
Simplified57.9%
Taylor expanded in y around 0 57.6%
mul-1-neg57.6%
+-commutative57.6%
unsub-neg57.6%
+-commutative57.6%
*-commutative57.6%
*-commutative57.6%
unpow257.6%
associate-*r*57.6%
*-commutative57.6%
associate-*r*57.6%
*-commutative57.6%
distribute-lft-out57.6%
*-commutative57.6%
*-commutative57.6%
Simplified57.6%
Final simplification57.6%
(FPCore (x y z t) :precision binary64 (if (<= z 4.1e+211) (- t) (* z (- y))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4.1e+211) {
tmp = -t;
} else {
tmp = 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) :: tmp
if (z <= 4.1d+211) then
tmp = -t
else
tmp = z * -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4.1e+211) {
tmp = -t;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 4.1e+211: tmp = -t else: tmp = z * -y return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 4.1e+211) tmp = Float64(-t); else tmp = Float64(z * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 4.1e+211) tmp = -t; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 4.1e+211], (-t), N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4.1 \cdot 10^{+211}:\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if z < 4.0999999999999999e211Initial program 90.4%
Taylor expanded in t around inf 45.2%
mul-1-neg45.2%
Simplified45.2%
if 4.0999999999999999e211 < z Initial program 37.4%
+-commutative37.4%
fma-def37.4%
sub-neg37.4%
log1p-def99.9%
Simplified99.9%
Taylor expanded in y around 0 96.8%
+-commutative96.8%
mul-1-neg96.8%
unsub-neg96.8%
Simplified96.8%
Taylor expanded in y around inf 60.2%
mul-1-neg60.2%
*-commutative60.2%
distribute-rgt-neg-in60.2%
Simplified60.2%
Final simplification46.7%
(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 85.2%
Taylor expanded in x around 0 43.4%
sub-neg43.4%
mul-1-neg43.4%
log1p-def57.9%
mul-1-neg57.9%
Simplified57.9%
Taylor expanded in y around 0 57.3%
distribute-lft-out57.3%
*-commutative57.3%
Simplified57.3%
Final simplification57.3%
(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 85.2%
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 2023271
(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))