
(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 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 86.1%
+-commutative86.1%
fma-def86.1%
sub-neg86.1%
log1p-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (- t) (fma y z (* (log y) (- x)))))
double code(double x, double y, double z, double t) {
return -t - fma(y, z, (log(y) * -x));
}
function code(x, y, z, t) return Float64(Float64(-t) - fma(y, z, Float64(log(y) * Float64(-x)))) end
code[x_, y_, z_, t_] := N[((-t) - N[(y * z + N[(N[Log[y], $MachinePrecision] * (-x)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-t\right) - \mathsf{fma}\left(y, z, \log y \cdot \left(-x\right)\right)
\end{array}
Initial program 86.1%
Taylor expanded in y around 0 99.1%
+-commutative99.1%
*-commutative99.1%
log-pow42.6%
mul-1-neg42.6%
unsub-neg42.6%
log-pow99.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in y around inf 99.1%
distribute-lft-out99.1%
mul-1-neg99.1%
fma-def99.1%
log-rec99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (x y z t)
:precision binary64
(if (or (<= x -1.4e+64)
(not
(or (<= x 1.55e-54) (and (not (<= x 2.35e-15)) (<= x 9.5e+100)))))
(* x (log y))
(- (* z (- (* y (* y -0.5)) y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.4e+64) || !((x <= 1.55e-54) || (!(x <= 2.35e-15) && (x <= 9.5e+100)))) {
tmp = x * log(y);
} else {
tmp = (z * ((y * (y * -0.5)) - y)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.4d+64)) .or. (.not. (x <= 1.55d-54) .or. (.not. (x <= 2.35d-15)) .and. (x <= 9.5d+100))) then
tmp = x * log(y)
else
tmp = (z * ((y * (y * (-0.5d0))) - y)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.4e+64) || !((x <= 1.55e-54) || (!(x <= 2.35e-15) && (x <= 9.5e+100)))) {
tmp = x * Math.log(y);
} else {
tmp = (z * ((y * (y * -0.5)) - y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.4e+64) or not ((x <= 1.55e-54) or (not (x <= 2.35e-15) and (x <= 9.5e+100))): tmp = x * math.log(y) else: tmp = (z * ((y * (y * -0.5)) - y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.4e+64) || !((x <= 1.55e-54) || (!(x <= 2.35e-15) && (x <= 9.5e+100)))) tmp = Float64(x * log(y)); else tmp = Float64(Float64(z * Float64(Float64(y * Float64(y * -0.5)) - y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.4e+64) || ~(((x <= 1.55e-54) || (~((x <= 2.35e-15)) && (x <= 9.5e+100))))) tmp = x * log(y); else tmp = (z * ((y * (y * -0.5)) - y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.4e+64], N[Not[Or[LessEqual[x, 1.55e-54], And[N[Not[LessEqual[x, 2.35e-15]], $MachinePrecision], LessEqual[x, 9.5e+100]]]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[(z * N[(N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+64} \lor \neg \left(x \leq 1.55 \cdot 10^{-54} \lor \neg \left(x \leq 2.35 \cdot 10^{-15}\right) \land x \leq 9.5 \cdot 10^{+100}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right) - t\\
\end{array}
\end{array}
if x < -1.40000000000000012e64 or 1.55000000000000002e-54 < x < 2.3499999999999999e-15 or 9.4999999999999995e100 < x Initial program 95.6%
Taylor expanded in y around 0 99.6%
+-commutative99.6%
*-commutative99.6%
log-pow8.3%
mul-1-neg8.3%
unsub-neg8.3%
log-pow99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in y around inf 99.6%
distribute-lft-out99.6%
mul-1-neg99.6%
fma-def99.6%
log-rec99.6%
Simplified99.6%
Taylor expanded in x around inf 84.8%
if -1.40000000000000012e64 < x < 1.55000000000000002e-54 or 2.3499999999999999e-15 < x < 9.4999999999999995e100Initial program 80.1%
+-commutative80.1%
fma-def80.1%
sub-neg80.1%
log1p-def99.9%
Simplified99.9%
Taylor expanded in x around 0 62.5%
fma-neg62.5%
sub-neg62.5%
mul-1-neg62.5%
log1p-def81.5%
mul-1-neg81.5%
Simplified81.5%
Taylor expanded in y around 0 80.7%
mul-1-neg80.7%
+-commutative80.7%
associate-+r+80.7%
associate-*r*80.7%
associate-*r*80.7%
distribute-rgt-out80.7%
mul-1-neg80.7%
unsub-neg80.7%
*-commutative80.7%
unpow280.7%
associate-*l*80.7%
Simplified80.7%
Final simplification82.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (log y)))) (if (or (<= t -1.4e-62) (not (<= t 4.5e-89))) (- t_1 t) (- t_1 (* z y)))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if ((t <= -1.4e-62) || !(t <= 4.5e-89)) {
tmp = t_1 - t;
} else {
tmp = t_1 - (z * y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * log(y)
if ((t <= (-1.4d-62)) .or. (.not. (t <= 4.5d-89))) then
tmp = t_1 - t
else
tmp = t_1 - (z * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * Math.log(y);
double tmp;
if ((t <= -1.4e-62) || !(t <= 4.5e-89)) {
tmp = t_1 - t;
} else {
tmp = t_1 - (z * y);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if (t <= -1.4e-62) or not (t <= 4.5e-89): tmp = t_1 - t else: tmp = t_1 - (z * y) return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if ((t <= -1.4e-62) || !(t <= 4.5e-89)) tmp = Float64(t_1 - t); else tmp = Float64(t_1 - Float64(z * y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if ((t <= -1.4e-62) || ~((t <= 4.5e-89))) tmp = t_1 - t; else tmp = t_1 - (z * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t, -1.4e-62], N[Not[LessEqual[t, 4.5e-89]], $MachinePrecision]], N[(t$95$1 - t), $MachinePrecision], N[(t$95$1 - N[(z * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;t \leq -1.4 \cdot 10^{-62} \lor \neg \left(t \leq 4.5 \cdot 10^{-89}\right):\\
\;\;\;\;t_1 - t\\
\mathbf{else}:\\
\;\;\;\;t_1 - z \cdot y\\
\end{array}
\end{array}
if t < -1.40000000000000001e-62 or 4.4999999999999999e-89 < t Initial program 93.6%
+-commutative93.6%
fma-def93.6%
sub-neg93.6%
log1p-def99.8%
Simplified99.8%
Taylor expanded in z around 0 92.8%
if -1.40000000000000001e-62 < t < 4.4999999999999999e-89Initial program 71.9%
Taylor expanded in y around 0 98.9%
+-commutative98.9%
*-commutative98.9%
log-pow36.9%
mul-1-neg36.9%
unsub-neg36.9%
log-pow98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in t around 0 89.8%
Final simplification91.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -6.2e-65) (not (<= x 8.5e-216))) (- (* x (log y)) t) (- (* z (log1p (- y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.2e-65) || !(x <= 8.5e-216)) {
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 <= -6.2e-65) || !(x <= 8.5e-216)) {
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 <= -6.2e-65) or not (x <= 8.5e-216): 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 <= -6.2e-65) || !(x <= 8.5e-216)) 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, -6.2e-65], N[Not[LessEqual[x, 8.5e-216]], $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 -6.2 \cdot 10^{-65} \lor \neg \left(x \leq 8.5 \cdot 10^{-216}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\end{array}
\end{array}
if x < -6.20000000000000032e-65 or 8.50000000000000003e-216 < x Initial program 90.3%
+-commutative90.3%
fma-def90.3%
sub-neg90.3%
log1p-def99.7%
Simplified99.7%
Taylor expanded in z around 0 89.9%
if -6.20000000000000032e-65 < x < 8.50000000000000003e-216Initial program 72.8%
Taylor expanded in x around 0 69.9%
sub-neg69.9%
mul-1-neg69.9%
log1p-def97.0%
mul-1-neg97.0%
Simplified97.0%
Final simplification91.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -6.8e-70) (not (<= x 8e-216))) (- (* x (log y)) t) (- (* z (- (* y (* y -0.5)) y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.8e-70) || !(x <= 8e-216)) {
tmp = (x * log(y)) - t;
} else {
tmp = (z * ((y * (y * -0.5)) - y)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-6.8d-70)) .or. (.not. (x <= 8d-216))) then
tmp = (x * log(y)) - t
else
tmp = (z * ((y * (y * (-0.5d0))) - y)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.8e-70) || !(x <= 8e-216)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = (z * ((y * (y * -0.5)) - y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6.8e-70) or not (x <= 8e-216): tmp = (x * math.log(y)) - t else: tmp = (z * ((y * (y * -0.5)) - y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6.8e-70) || !(x <= 8e-216)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(z * Float64(Float64(y * Float64(y * -0.5)) - y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -6.8e-70) || ~((x <= 8e-216))) tmp = (x * log(y)) - t; else tmp = (z * ((y * (y * -0.5)) - y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6.8e-70], N[Not[LessEqual[x, 8e-216]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * N[(N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{-70} \lor \neg \left(x \leq 8 \cdot 10^{-216}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right) - t\\
\end{array}
\end{array}
if x < -6.79999999999999991e-70 or 8.0000000000000003e-216 < x Initial program 90.3%
+-commutative90.3%
fma-def90.3%
sub-neg90.3%
log1p-def99.7%
Simplified99.7%
Taylor expanded in z around 0 89.9%
if -6.79999999999999991e-70 < x < 8.0000000000000003e-216Initial program 72.8%
+-commutative72.8%
fma-def72.8%
sub-neg72.8%
log1p-def99.9%
Simplified99.9%
Taylor expanded in x around 0 69.9%
fma-neg69.9%
sub-neg69.9%
mul-1-neg69.9%
log1p-def97.1%
mul-1-neg97.1%
Simplified97.1%
Taylor expanded in y around 0 95.8%
mul-1-neg95.8%
+-commutative95.8%
associate-+r+95.8%
associate-*r*95.8%
associate-*r*95.8%
distribute-rgt-out95.8%
mul-1-neg95.8%
unsub-neg95.8%
*-commutative95.8%
unpow295.8%
associate-*l*95.8%
Simplified95.8%
Final simplification91.3%
(FPCore (x y z t) :precision binary64 (- (- (* x (log y)) (* z y)) t))
double code(double x, double y, double z, double t) {
return ((x * log(y)) - (z * y)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x * log(y)) - (z * y)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x * Math.log(y)) - (z * y)) - t;
}
def code(x, y, z, t): return ((x * math.log(y)) - (z * y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(x * log(y)) - Float64(z * y)) - t) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) - (z * y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log y - z \cdot y\right) - t
\end{array}
Initial program 86.1%
Taylor expanded in y around 0 99.1%
+-commutative99.1%
*-commutative99.1%
log-pow42.6%
mul-1-neg42.6%
unsub-neg42.6%
log-pow99.1%
*-commutative99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (- (* z (- (* y (* y -0.5)) y)) t))
double code(double x, double y, double z, double t) {
return (z * ((y * (y * -0.5)) - y)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (z * ((y * (y * (-0.5d0))) - y)) - t
end function
public static double code(double x, double y, double z, double t) {
return (z * ((y * (y * -0.5)) - y)) - t;
}
def code(x, y, z, t): return (z * ((y * (y * -0.5)) - y)) - t
function code(x, y, z, t) return Float64(Float64(z * Float64(Float64(y * Float64(y * -0.5)) - y)) - t) end
function tmp = code(x, y, z, t) tmp = (z * ((y * (y * -0.5)) - y)) - t; end
code[x_, y_, z_, t_] := N[(N[(z * N[(N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right) - t
\end{array}
Initial program 86.1%
+-commutative86.1%
fma-def86.1%
sub-neg86.1%
log1p-def99.8%
Simplified99.8%
Taylor expanded in x around 0 43.1%
fma-neg43.1%
sub-neg43.1%
mul-1-neg43.1%
log1p-def56.0%
mul-1-neg56.0%
Simplified56.0%
Taylor expanded in y around 0 55.6%
mul-1-neg55.6%
+-commutative55.6%
associate-+r+55.6%
associate-*r*55.6%
associate-*r*55.6%
distribute-rgt-out55.6%
mul-1-neg55.6%
unsub-neg55.6%
*-commutative55.6%
unpow255.6%
associate-*l*55.6%
Simplified55.6%
Final simplification55.6%
(FPCore (x y z t) :precision binary64 (if (<= t -7.8e-75) (- t) (if (<= t 2.6e-86) (* y (- z)) (- (* z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7.8e-75) {
tmp = -t;
} else if (t <= 2.6e-86) {
tmp = y * -z;
} 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 (t <= (-7.8d-75)) then
tmp = -t
else if (t <= 2.6d-86) then
tmp = y * -z
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 (t <= -7.8e-75) {
tmp = -t;
} else if (t <= 2.6e-86) {
tmp = y * -z;
} else {
tmp = (z * y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -7.8e-75: tmp = -t elif t <= 2.6e-86: tmp = y * -z else: tmp = (z * y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -7.8e-75) tmp = Float64(-t); elseif (t <= 2.6e-86) tmp = Float64(y * Float64(-z)); else tmp = Float64(Float64(z * y) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -7.8e-75) tmp = -t; elseif (t <= 2.6e-86) tmp = y * -z; else tmp = (z * y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -7.8e-75], (-t), If[LessEqual[t, 2.6e-86], N[(y * (-z)), $MachinePrecision], N[(N[(z * y), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.8 \cdot 10^{-75}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 2.6 \cdot 10^{-86}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot y - t\\
\end{array}
\end{array}
if t < -7.8000000000000003e-75Initial program 91.0%
+-commutative91.0%
fma-def91.0%
sub-neg91.0%
log1p-def99.8%
Simplified99.8%
Taylor expanded in t around inf 55.1%
mul-1-neg55.1%
Simplified55.1%
if -7.8000000000000003e-75 < t < 2.6000000000000001e-86Initial program 71.9%
Taylor expanded in y around 0 98.9%
+-commutative98.9%
*-commutative98.9%
log-pow36.4%
mul-1-neg36.4%
unsub-neg36.4%
log-pow98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in y around inf 98.9%
distribute-lft-out98.9%
mul-1-neg98.9%
fma-def98.9%
log-rec98.9%
Simplified98.9%
Taylor expanded in y around inf 29.9%
associate-*r*29.9%
neg-mul-129.9%
Simplified29.9%
if 2.6000000000000001e-86 < t Initial program 96.1%
*-commutative96.1%
add-cube-cbrt95.7%
associate-*l*95.6%
fma-def95.6%
cbrt-unprod95.8%
pow295.8%
sub-neg95.8%
log1p-udef99.5%
add-sqr-sqrt0.0%
sqrt-unprod95.8%
sqr-neg95.8%
sqrt-unprod95.7%
add-sqr-sqrt95.7%
Applied egg-rr95.7%
Taylor expanded in y around 0 95.7%
Taylor expanded in y around inf 61.4%
Final simplification48.4%
(FPCore (x y z t) :precision binary64 (if (<= t -6.2e-75) (- t) (if (<= t 3.3e-86) (* y (- z)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6.2e-75) {
tmp = -t;
} else if (t <= 3.3e-86) {
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 <= (-6.2d-75)) then
tmp = -t
else if (t <= 3.3d-86) 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 <= -6.2e-75) {
tmp = -t;
} else if (t <= 3.3e-86) {
tmp = y * -z;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -6.2e-75: tmp = -t elif t <= 3.3e-86: tmp = y * -z else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -6.2e-75) tmp = Float64(-t); elseif (t <= 3.3e-86) 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 <= -6.2e-75) tmp = -t; elseif (t <= 3.3e-86) tmp = y * -z; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -6.2e-75], (-t), If[LessEqual[t, 3.3e-86], N[(y * (-z)), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.2 \cdot 10^{-75}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 3.3 \cdot 10^{-86}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -6.20000000000000013e-75 or 3.29999999999999987e-86 < t Initial program 93.6%
+-commutative93.6%
fma-def93.6%
sub-neg93.6%
log1p-def99.8%
Simplified99.8%
Taylor expanded in t around inf 58.3%
mul-1-neg58.3%
Simplified58.3%
if -6.20000000000000013e-75 < t < 3.29999999999999987e-86Initial program 71.9%
Taylor expanded in y around 0 98.9%
+-commutative98.9%
*-commutative98.9%
log-pow36.4%
mul-1-neg36.4%
unsub-neg36.4%
log-pow98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in y around inf 98.9%
distribute-lft-out98.9%
mul-1-neg98.9%
fma-def98.9%
log-rec98.9%
Simplified98.9%
Taylor expanded in y around inf 29.9%
associate-*r*29.9%
neg-mul-129.9%
Simplified29.9%
Final simplification48.4%
(FPCore (x y z t) :precision binary64 (- (* y (- z)) t))
double code(double x, double y, double z, double t) {
return (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 = (y * -z) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * -z) - t;
}
def code(x, y, z, t): return (y * -z) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(-z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * -z) - t; end
code[x_, y_, z_, t_] := N[(N[(y * (-z)), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(-z\right) - t
\end{array}
Initial program 86.1%
Taylor expanded in y around 0 99.1%
+-commutative99.1%
*-commutative99.1%
log-pow42.6%
mul-1-neg42.6%
unsub-neg42.6%
log-pow99.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in y around inf 55.3%
mul-1-neg55.3%
distribute-rgt-neg-out55.3%
Simplified55.3%
Final simplification55.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 86.1%
+-commutative86.1%
fma-def86.1%
sub-neg86.1%
log1p-def99.8%
Simplified99.8%
Taylor expanded in t around inf 42.2%
mul-1-neg42.2%
Simplified42.2%
Final simplification42.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 2023268
(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))