
(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 84.2%
+-commutative84.2%
associate--l+84.2%
+-commutative84.2%
associate-+l-84.2%
fma-neg84.2%
sub0-neg84.2%
associate-+l-84.2%
neg-sub084.2%
+-commutative84.2%
fma-def84.2%
sub-neg84.2%
log1p-def99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (- (fma x (log y) (* z (log1p (- y)))) t))
double code(double x, double y, double z, double t) {
return fma(x, log(y), (z * log1p(-y))) - t;
}
function code(x, y, z, t) return Float64(fma(x, log(y), Float64(z * log1p(Float64(-y)))) - t) end
code[x_, y_, z_, t_] := N[(N[(x * N[Log[y], $MachinePrecision] + N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, \log y, z \cdot \mathsf{log1p}\left(-y\right)\right) - t
\end{array}
Initial program 84.2%
*-lft-identity84.2%
*-lft-identity84.2%
fma-def84.2%
sub-neg84.2%
log1p-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(if (or (<= x -1.28e+141)
(and (not (<= x -1.38e+103))
(or (<= x -3.1e+34)
(and (not (<= x 7.5e-5))
(or (<= x 1.4e+31) (not (<= x 4.6e+125)))))))
(* x (log y))
(- (- t) (* y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.28e+141) || (!(x <= -1.38e+103) && ((x <= -3.1e+34) || (!(x <= 7.5e-5) && ((x <= 1.4e+31) || !(x <= 4.6e+125)))))) {
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 <= (-1.28d+141)) .or. (.not. (x <= (-1.38d+103))) .and. (x <= (-3.1d+34)) .or. (.not. (x <= 7.5d-5)) .and. (x <= 1.4d+31) .or. (.not. (x <= 4.6d+125))) 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 <= -1.28e+141) || (!(x <= -1.38e+103) && ((x <= -3.1e+34) || (!(x <= 7.5e-5) && ((x <= 1.4e+31) || !(x <= 4.6e+125)))))) {
tmp = x * Math.log(y);
} else {
tmp = -t - (y * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.28e+141) or (not (x <= -1.38e+103) and ((x <= -3.1e+34) or (not (x <= 7.5e-5) and ((x <= 1.4e+31) or not (x <= 4.6e+125))))): tmp = x * math.log(y) else: tmp = -t - (y * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.28e+141) || (!(x <= -1.38e+103) && ((x <= -3.1e+34) || (!(x <= 7.5e-5) && ((x <= 1.4e+31) || !(x <= 4.6e+125)))))) 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 <= -1.28e+141) || (~((x <= -1.38e+103)) && ((x <= -3.1e+34) || (~((x <= 7.5e-5)) && ((x <= 1.4e+31) || ~((x <= 4.6e+125))))))) tmp = x * log(y); else tmp = -t - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.28e+141], And[N[Not[LessEqual[x, -1.38e+103]], $MachinePrecision], Or[LessEqual[x, -3.1e+34], And[N[Not[LessEqual[x, 7.5e-5]], $MachinePrecision], Or[LessEqual[x, 1.4e+31], N[Not[LessEqual[x, 4.6e+125]], $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 -1.28 \cdot 10^{+141} \lor \neg \left(x \leq -1.38 \cdot 10^{+103}\right) \land \left(x \leq -3.1 \cdot 10^{+34} \lor \neg \left(x \leq 7.5 \cdot 10^{-5}\right) \land \left(x \leq 1.4 \cdot 10^{+31} \lor \neg \left(x \leq 4.6 \cdot 10^{+125}\right)\right)\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - y \cdot z\\
\end{array}
\end{array}
if x < -1.28000000000000004e141 or -1.37999999999999993e103 < x < -3.09999999999999977e34 or 7.49999999999999934e-5 < x < 1.40000000000000008e31 or 4.60000000000000026e125 < x Initial program 96.3%
*-lft-identity96.3%
*-lft-identity96.3%
fma-def96.3%
sub-neg96.3%
log1p-def99.7%
Simplified99.7%
Taylor expanded in y around 0 99.7%
associate-+r+99.7%
associate-*r*99.7%
associate-*r*99.7%
distribute-rgt-out99.7%
mul-1-neg99.7%
unsub-neg99.7%
*-commutative99.7%
unpow299.7%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in x around inf 82.8%
if -1.28000000000000004e141 < x < -1.37999999999999993e103 or -3.09999999999999977e34 < x < 7.49999999999999934e-5 or 1.40000000000000008e31 < x < 4.60000000000000026e125Initial program 78.2%
Taylor expanded in x around 0 60.7%
sub-neg60.7%
mul-1-neg60.7%
log1p-def82.5%
mul-1-neg82.5%
Simplified82.5%
Taylor expanded in y around 0 81.2%
neg-mul-181.2%
+-commutative81.2%
unsub-neg81.2%
mul-1-neg81.2%
distribute-rgt-neg-in81.2%
Simplified81.2%
Final simplification81.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))) (t_2 (- (- t) (* y z))))
(if (<= x -1.28e+141)
t_1
(if (<= x -5.5e+101)
t_2
(if (<= x -1.8e+36)
t_1
(if (<= x 4e-5)
(- (fma y z t))
(if (or (<= x 1.3e+31) (not (<= x 4.6e+125))) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double t_2 = -t - (y * z);
double tmp;
if (x <= -1.28e+141) {
tmp = t_1;
} else if (x <= -5.5e+101) {
tmp = t_2;
} else if (x <= -1.8e+36) {
tmp = t_1;
} else if (x <= 4e-5) {
tmp = -fma(y, z, t);
} else if ((x <= 1.3e+31) || !(x <= 4.6e+125)) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * log(y)) t_2 = Float64(Float64(-t) - Float64(y * z)) tmp = 0.0 if (x <= -1.28e+141) tmp = t_1; elseif (x <= -5.5e+101) tmp = t_2; elseif (x <= -1.8e+36) tmp = t_1; elseif (x <= 4e-5) tmp = Float64(-fma(y, z, t)); elseif ((x <= 1.3e+31) || !(x <= 4.6e+125)) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-t) - N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.28e+141], t$95$1, If[LessEqual[x, -5.5e+101], t$95$2, If[LessEqual[x, -1.8e+36], t$95$1, If[LessEqual[x, 4e-5], (-N[(y * z + t), $MachinePrecision]), If[Or[LessEqual[x, 1.3e+31], N[Not[LessEqual[x, 4.6e+125]], $MachinePrecision]], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
t_2 := \left(-t\right) - y \cdot z\\
\mathbf{if}\;x \leq -1.28 \cdot 10^{+141}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -5.5 \cdot 10^{+101}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.8 \cdot 10^{+36}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-5}:\\
\;\;\;\;-\mathsf{fma}\left(y, z, t\right)\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+31} \lor \neg \left(x \leq 4.6 \cdot 10^{+125}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if x < -1.28000000000000004e141 or -5.50000000000000018e101 < x < -1.7999999999999999e36 or 4.00000000000000033e-5 < x < 1.3e31 or 4.60000000000000026e125 < x Initial program 96.3%
*-lft-identity96.3%
*-lft-identity96.3%
fma-def96.3%
sub-neg96.3%
log1p-def99.7%
Simplified99.7%
Taylor expanded in y around 0 99.7%
associate-+r+99.7%
associate-*r*99.7%
associate-*r*99.7%
distribute-rgt-out99.7%
mul-1-neg99.7%
unsub-neg99.7%
*-commutative99.7%
unpow299.7%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in x around inf 82.8%
if -1.28000000000000004e141 < x < -5.50000000000000018e101 or 1.3e31 < x < 4.60000000000000026e125Initial program 86.8%
Taylor expanded in x around 0 61.7%
sub-neg61.7%
mul-1-neg61.7%
log1p-def75.0%
mul-1-neg75.0%
Simplified75.0%
Taylor expanded in y around 0 73.3%
neg-mul-173.3%
+-commutative73.3%
unsub-neg73.3%
mul-1-neg73.3%
distribute-rgt-neg-in73.3%
Simplified73.3%
if -1.7999999999999999e36 < x < 4.00000000000000033e-5Initial program 76.3%
Taylor expanded in x around 0 60.5%
sub-neg60.5%
mul-1-neg60.5%
log1p-def84.1%
mul-1-neg84.1%
Simplified84.1%
Taylor expanded in y around 0 83.0%
neg-mul-183.0%
+-commutative83.0%
unsub-neg83.0%
mul-1-neg83.0%
distribute-rgt-neg-in83.0%
Simplified83.0%
Taylor expanded in y around 0 83.0%
distribute-lft-out83.0%
+-commutative83.0%
fma-def83.0%
neg-mul-183.0%
Simplified83.0%
Final simplification81.7%
(FPCore (x y z t) :precision binary64 (- (+ (* z (- (* y (* y -0.5)) y)) (* x (log y))) t))
double code(double x, double y, double z, double t) {
return ((z * ((y * (y * -0.5)) - y)) + (x * 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 = ((z * ((y * (y * (-0.5d0))) - y)) + (x * log(y))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((z * ((y * (y * -0.5)) - y)) + (x * Math.log(y))) - t;
}
def code(x, y, z, t): return ((z * ((y * (y * -0.5)) - y)) + (x * math.log(y))) - t
function code(x, y, z, t) return Float64(Float64(Float64(z * Float64(Float64(y * Float64(y * -0.5)) - y)) + Float64(x * log(y))) - t) end
function tmp = code(x, y, z, t) tmp = ((z * ((y * (y * -0.5)) - y)) + (x * log(y))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(z * N[(N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right) + x \cdot \log y\right) - t
\end{array}
Initial program 84.2%
*-lft-identity84.2%
*-lft-identity84.2%
fma-def84.2%
sub-neg84.2%
log1p-def99.8%
Simplified99.8%
Taylor expanded in y around 0 99.3%
associate-+r+99.3%
associate-*r*99.3%
associate-*r*99.3%
distribute-rgt-out99.3%
mul-1-neg99.3%
unsub-neg99.3%
*-commutative99.3%
unpow299.3%
associate-*l*99.3%
Simplified99.3%
Final simplification99.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.5e-76) (not (<= x 1.3e-43))) (- (* x (log y)) t) (- (* z (log1p (- y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.5e-76) || !(x <= 1.3e-43)) {
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 <= -3.5e-76) || !(x <= 1.3e-43)) {
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 <= -3.5e-76) or not (x <= 1.3e-43): 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 <= -3.5e-76) || !(x <= 1.3e-43)) 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, -3.5e-76], N[Not[LessEqual[x, 1.3e-43]], $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 -3.5 \cdot 10^{-76} \lor \neg \left(x \leq 1.3 \cdot 10^{-43}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\end{array}
\end{array}
if x < -3.49999999999999997e-76 or 1.3e-43 < x Initial program 93.8%
Taylor expanded in y around 0 92.4%
if -3.49999999999999997e-76 < x < 1.3e-43Initial program 70.4%
Taylor expanded in x around 0 62.9%
sub-neg62.9%
mul-1-neg62.9%
log1p-def92.5%
mul-1-neg92.5%
Simplified92.5%
Final simplification92.4%
(FPCore (x y z t) :precision binary64 (if (<= x -1e-76) (- (- t) (* x (log (/ 1.0 y)))) (if (<= x 1.2e-43) (- (* z (log1p (- y))) t) (- (* x (log y)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1e-76) {
tmp = -t - (x * log((1.0 / y)));
} else if (x <= 1.2e-43) {
tmp = (z * log1p(-y)) - t;
} else {
tmp = (x * log(y)) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1e-76) {
tmp = -t - (x * Math.log((1.0 / y)));
} else if (x <= 1.2e-43) {
tmp = (z * Math.log1p(-y)) - t;
} else {
tmp = (x * Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1e-76: tmp = -t - (x * math.log((1.0 / y))) elif x <= 1.2e-43: tmp = (z * math.log1p(-y)) - t else: tmp = (x * math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1e-76) tmp = Float64(Float64(-t) - Float64(x * log(Float64(1.0 / y)))); elseif (x <= 1.2e-43) tmp = Float64(Float64(z * log1p(Float64(-y))) - t); else tmp = Float64(Float64(x * log(y)) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, -1e-76], N[((-t) - N[(x * N[Log[N[(1.0 / y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.2e-43], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-76}:\\
\;\;\;\;\left(-t\right) - x \cdot \log \left(\frac{1}{y}\right)\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-43}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \log y - t\\
\end{array}
\end{array}
if x < -9.99999999999999927e-77Initial program 94.2%
Taylor expanded in y around inf 94.2%
Taylor expanded in z around 0 91.4%
if -9.99999999999999927e-77 < x < 1.2000000000000001e-43Initial program 70.4%
Taylor expanded in x around 0 62.9%
sub-neg62.9%
mul-1-neg62.9%
log1p-def92.5%
mul-1-neg92.5%
Simplified92.5%
if 1.2000000000000001e-43 < x Initial program 93.4%
Taylor expanded in y around 0 93.4%
Final simplification92.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -6.5e-77) (not (<= x 1.2e-43))) (- (* x (log y)) t) (- (fma y z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.5e-77) || !(x <= 1.2e-43)) {
tmp = (x * log(y)) - t;
} else {
tmp = -fma(y, z, t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((x <= -6.5e-77) || !(x <= 1.2e-43)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(-fma(y, z, t)); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6.5e-77], N[Not[LessEqual[x, 1.2e-43]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], (-N[(y * z + t), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{-77} \lor \neg \left(x \leq 1.2 \cdot 10^{-43}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;-\mathsf{fma}\left(y, z, t\right)\\
\end{array}
\end{array}
if x < -6.4999999999999999e-77 or 1.2000000000000001e-43 < x Initial program 93.8%
Taylor expanded in y around 0 92.4%
if -6.4999999999999999e-77 < x < 1.2000000000000001e-43Initial program 70.4%
Taylor expanded in x around 0 62.9%
sub-neg62.9%
mul-1-neg62.9%
log1p-def92.5%
mul-1-neg92.5%
Simplified92.5%
Taylor expanded in y around 0 91.7%
neg-mul-191.7%
+-commutative91.7%
unsub-neg91.7%
mul-1-neg91.7%
distribute-rgt-neg-in91.7%
Simplified91.7%
Taylor expanded in y around 0 91.7%
distribute-lft-out91.7%
+-commutative91.7%
fma-def91.7%
neg-mul-191.7%
Simplified91.7%
Final simplification92.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 84.2%
Taylor expanded in y around 0 99.0%
+-commutative99.0%
*-commutative99.0%
mul-1-neg99.0%
unsub-neg99.0%
*-commutative99.0%
Simplified99.0%
Final simplification99.0%
(FPCore (x y z t) :precision binary64 (if (<= t -8e-20) (- t) (if (<= t 1.26e-34) (* y (- z)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8e-20) {
tmp = -t;
} else if (t <= 1.26e-34) {
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 <= (-8d-20)) then
tmp = -t
else if (t <= 1.26d-34) 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 <= -8e-20) {
tmp = -t;
} else if (t <= 1.26e-34) {
tmp = y * -z;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -8e-20: tmp = -t elif t <= 1.26e-34: tmp = y * -z else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -8e-20) tmp = Float64(-t); elseif (t <= 1.26e-34) 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 <= -8e-20) tmp = -t; elseif (t <= 1.26e-34) tmp = y * -z; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -8e-20], (-t), If[LessEqual[t, 1.26e-34], N[(y * (-z)), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{-20}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 1.26 \cdot 10^{-34}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -7.99999999999999956e-20 or 1.26000000000000009e-34 < t Initial program 94.9%
Taylor expanded in t around inf 72.5%
mul-1-neg72.5%
Simplified72.5%
if -7.99999999999999956e-20 < t < 1.26000000000000009e-34Initial program 72.5%
Taylor expanded in x around 0 15.9%
sub-neg15.9%
mul-1-neg15.9%
log1p-def43.3%
mul-1-neg43.3%
Simplified43.3%
Taylor expanded in y around 0 41.6%
neg-mul-141.6%
+-commutative41.6%
unsub-neg41.6%
mul-1-neg41.6%
distribute-rgt-neg-in41.6%
Simplified41.6%
Taylor expanded in y around inf 30.8%
mul-1-neg30.8%
distribute-rgt-neg-in30.8%
Simplified30.8%
Final simplification52.6%
(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 84.2%
Taylor expanded in x around 0 45.7%
sub-neg45.7%
mul-1-neg45.7%
log1p-def61.4%
mul-1-neg61.4%
Simplified61.4%
Taylor expanded in y around 0 60.6%
neg-mul-160.6%
+-commutative60.6%
unsub-neg60.6%
mul-1-neg60.6%
distribute-rgt-neg-in60.6%
Simplified60.6%
Final simplification60.6%
(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 84.2%
Taylor expanded in t around inf 44.3%
mul-1-neg44.3%
Simplified44.3%
Final simplification44.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 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 84.2%
sub-neg84.2%
associate-+r+84.2%
sub-neg84.2%
log1p-udef99.8%
fma-udef99.9%
*-commutative99.9%
add-sqr-sqrt51.4%
associate-*r*51.4%
fma-def51.4%
add-sqr-sqrt0.0%
sqrt-unprod42.3%
sqr-neg42.3%
sqrt-unprod42.2%
add-sqr-sqrt42.2%
add-sqr-sqrt20.7%
sqrt-unprod23.9%
sqr-neg23.9%
sqrt-unprod10.6%
add-sqr-sqrt19.7%
Applied egg-rr19.7%
Taylor expanded in t around inf 2.2%
Final simplification2.2%
(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 2023200
(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))