
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (+ (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
double code(double t, double l, double k) {
return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) + 1.0));
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = 2.0d0 / (((((t ** 3.0d0) / (l * l)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) + 1.0d0))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((((Math.pow(t, 3.0) / (l * l)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) + 1.0));
}
def code(t, l, k): return 2.0 / ((((math.pow(t, 3.0) / (l * l)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) + 1.0))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) + 1.0))) end
function tmp = code(t, l, k) tmp = 2.0 / (((((t ^ 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) + 1.0)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 6 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (+ (+ 1.0 (pow (/ k t) 2.0)) 1.0))))
double code(double t, double l, double k) {
return 2.0 / ((((pow(t, 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + pow((k / t), 2.0)) + 1.0));
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = 2.0d0 / (((((t ** 3.0d0) / (l * l)) * sin(k)) * tan(k)) * ((1.0d0 + ((k / t) ** 2.0d0)) + 1.0d0))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((((Math.pow(t, 3.0) / (l * l)) * Math.sin(k)) * Math.tan(k)) * ((1.0 + Math.pow((k / t), 2.0)) + 1.0));
}
def code(t, l, k): return 2.0 / ((((math.pow(t, 3.0) / (l * l)) * math.sin(k)) * math.tan(k)) * ((1.0 + math.pow((k / t), 2.0)) + 1.0))
function code(t, l, k) return Float64(2.0 / Float64(Float64(Float64(Float64((t ^ 3.0) / Float64(l * l)) * sin(k)) * tan(k)) * Float64(Float64(1.0 + (Float64(k / t) ^ 2.0)) + 1.0))) end
function tmp = code(t, l, k) tmp = 2.0 / (((((t ^ 3.0) / (l * l)) * sin(k)) * tan(k)) * ((1.0 + ((k / t) ^ 2.0)) + 1.0)); end
code[t_, l_, k_] := N[(2.0 / N[(N[(N[(N[(N[Power[t, 3.0], $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[Power[N[(k / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(\left(\frac{{t}^{3}}{\ell \cdot \ell} \cdot \sin k\right) \cdot \tan k\right) \cdot \left(\left(1 + {\left(\frac{k}{t}\right)}^{2}\right) + 1\right)}
\end{array}
NOTE: k should be positive before calling this function
(FPCore (t l k)
:precision binary64
(if (<= k 10000000.0)
(/ (/ l k) (* (pow t 3.0) (/ k l)))
(if (<= k 4.1e+126)
(* l (* l (/ 2.0 (* (tan k) (* k (* k (* t (sin k))))))))
(/ 2.0 (* (/ t (pow (/ l k) 2.0)) (* (tan k) (sin k)))))))k = abs(k);
double code(double t, double l, double k) {
double tmp;
if (k <= 10000000.0) {
tmp = (l / k) / (pow(t, 3.0) * (k / l));
} else if (k <= 4.1e+126) {
tmp = l * (l * (2.0 / (tan(k) * (k * (k * (t * sin(k)))))));
} else {
tmp = 2.0 / ((t / pow((l / k), 2.0)) * (tan(k) * sin(k)));
}
return tmp;
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: tmp
if (k <= 10000000.0d0) then
tmp = (l / k) / ((t ** 3.0d0) * (k / l))
else if (k <= 4.1d+126) then
tmp = l * (l * (2.0d0 / (tan(k) * (k * (k * (t * sin(k)))))))
else
tmp = 2.0d0 / ((t / ((l / k) ** 2.0d0)) * (tan(k) * sin(k)))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double tmp;
if (k <= 10000000.0) {
tmp = (l / k) / (Math.pow(t, 3.0) * (k / l));
} else if (k <= 4.1e+126) {
tmp = l * (l * (2.0 / (Math.tan(k) * (k * (k * (t * Math.sin(k)))))));
} else {
tmp = 2.0 / ((t / Math.pow((l / k), 2.0)) * (Math.tan(k) * Math.sin(k)));
}
return tmp;
}
k = abs(k) def code(t, l, k): tmp = 0 if k <= 10000000.0: tmp = (l / k) / (math.pow(t, 3.0) * (k / l)) elif k <= 4.1e+126: tmp = l * (l * (2.0 / (math.tan(k) * (k * (k * (t * math.sin(k))))))) else: tmp = 2.0 / ((t / math.pow((l / k), 2.0)) * (math.tan(k) * math.sin(k))) return tmp
k = abs(k) function code(t, l, k) tmp = 0.0 if (k <= 10000000.0) tmp = Float64(Float64(l / k) / Float64((t ^ 3.0) * Float64(k / l))); elseif (k <= 4.1e+126) tmp = Float64(l * Float64(l * Float64(2.0 / Float64(tan(k) * Float64(k * Float64(k * Float64(t * sin(k)))))))); else tmp = Float64(2.0 / Float64(Float64(t / (Float64(l / k) ^ 2.0)) * Float64(tan(k) * sin(k)))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 10000000.0) tmp = (l / k) / ((t ^ 3.0) * (k / l)); elseif (k <= 4.1e+126) tmp = l * (l * (2.0 / (tan(k) * (k * (k * (t * sin(k))))))); else tmp = 2.0 / ((t / ((l / k) ^ 2.0)) * (tan(k) * sin(k))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function code[t_, l_, k_] := If[LessEqual[k, 10000000.0], N[(N[(l / k), $MachinePrecision] / N[(N[Power[t, 3.0], $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 4.1e+126], N[(l * N[(l * N[(2.0 / N[(N[Tan[k], $MachinePrecision] * N[(k * N[(k * N[(t * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(t / N[Power[N[(l / k), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(N[Tan[k], $MachinePrecision] * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
\mathbf{if}\;k \leq 10000000:\\
\;\;\;\;\frac{\frac{\ell}{k}}{{t}^{3} \cdot \frac{k}{\ell}}\\
\mathbf{elif}\;k \leq 4.1 \cdot 10^{+126}:\\
\;\;\;\;\ell \cdot \left(\ell \cdot \frac{2}{\tan k \cdot \left(k \cdot \left(k \cdot \left(t \cdot \sin k\right)\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{t}{{\left(\frac{\ell}{k}\right)}^{2}} \cdot \left(\tan k \cdot \sin k\right)}\\
\end{array}
\end{array}
if k < 1e7Initial program 54.7%
*-commutative54.7%
associate-*l*48.6%
associate-*r*48.6%
+-commutative48.6%
associate-+r+48.6%
metadata-eval48.6%
Simplified48.6%
Taylor expanded in k around 0 49.6%
associate-/l*49.2%
unpow249.2%
unpow249.2%
associate-*r/56.9%
times-frac66.7%
Simplified66.7%
expm1-log1p-u44.1%
expm1-udef41.4%
associate-/r*41.4%
metadata-eval41.4%
associate-/r/41.9%
Applied egg-rr41.9%
expm1-def46.3%
expm1-log1p69.0%
associate-/r*69.0%
*-commutative69.0%
Simplified69.0%
Taylor expanded in k around 0 69.0%
if 1e7 < k < 4.1000000000000001e126Initial program 35.1%
associate-/l/35.1%
associate-*l/35.0%
associate-*l/35.1%
associate-/r/35.1%
*-commutative35.1%
associate-/l/35.1%
associate-*r*35.1%
*-commutative35.1%
associate-*r*35.0%
*-commutative35.0%
Simplified35.0%
Taylor expanded in k around inf 66.5%
unpow266.5%
*-commutative66.5%
Simplified66.5%
expm1-log1p-u44.3%
expm1-udef32.1%
associate-*l*40.3%
Applied egg-rr40.3%
expm1-def60.4%
expm1-log1p87.1%
associate-*l*87.1%
Simplified87.1%
if 4.1000000000000001e126 < k Initial program 53.9%
*-commutative53.9%
associate-*l*53.9%
associate-*r*53.9%
+-commutative53.9%
associate-+r+53.9%
metadata-eval53.9%
Simplified53.9%
Taylor expanded in k around inf 72.1%
associate-/l*72.2%
unpow272.2%
unpow272.2%
Simplified72.2%
Taylor expanded in k around 0 72.1%
*-commutative72.1%
associate-/l*74.6%
unpow274.6%
unpow274.6%
times-frac95.0%
*-lft-identity95.0%
associate-*l/95.1%
*-lft-identity95.1%
associate-*l/95.0%
unpow195.0%
pow-plus95.0%
associate-*l/95.0%
*-lft-identity95.0%
metadata-eval95.0%
Simplified95.0%
Final simplification74.6%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (if (<= k 10200000.0) (/ (/ l k) (* (pow t 3.0) (/ k l))) (* l (* l (/ 2.0 (* (tan k) (* k (* k (* t (sin k))))))))))
k = abs(k);
double code(double t, double l, double k) {
double tmp;
if (k <= 10200000.0) {
tmp = (l / k) / (pow(t, 3.0) * (k / l));
} else {
tmp = l * (l * (2.0 / (tan(k) * (k * (k * (t * sin(k)))))));
}
return tmp;
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: tmp
if (k <= 10200000.0d0) then
tmp = (l / k) / ((t ** 3.0d0) * (k / l))
else
tmp = l * (l * (2.0d0 / (tan(k) * (k * (k * (t * sin(k)))))))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double tmp;
if (k <= 10200000.0) {
tmp = (l / k) / (Math.pow(t, 3.0) * (k / l));
} else {
tmp = l * (l * (2.0 / (Math.tan(k) * (k * (k * (t * Math.sin(k)))))));
}
return tmp;
}
k = abs(k) def code(t, l, k): tmp = 0 if k <= 10200000.0: tmp = (l / k) / (math.pow(t, 3.0) * (k / l)) else: tmp = l * (l * (2.0 / (math.tan(k) * (k * (k * (t * math.sin(k))))))) return tmp
k = abs(k) function code(t, l, k) tmp = 0.0 if (k <= 10200000.0) tmp = Float64(Float64(l / k) / Float64((t ^ 3.0) * Float64(k / l))); else tmp = Float64(l * Float64(l * Float64(2.0 / Float64(tan(k) * Float64(k * Float64(k * Float64(t * sin(k)))))))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 10200000.0) tmp = (l / k) / ((t ^ 3.0) * (k / l)); else tmp = l * (l * (2.0 / (tan(k) * (k * (k * (t * sin(k))))))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function code[t_, l_, k_] := If[LessEqual[k, 10200000.0], N[(N[(l / k), $MachinePrecision] / N[(N[Power[t, 3.0], $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l * N[(l * N[(2.0 / N[(N[Tan[k], $MachinePrecision] * N[(k * N[(k * N[(t * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
\mathbf{if}\;k \leq 10200000:\\
\;\;\;\;\frac{\frac{\ell}{k}}{{t}^{3} \cdot \frac{k}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\ell \cdot \left(\ell \cdot \frac{2}{\tan k \cdot \left(k \cdot \left(k \cdot \left(t \cdot \sin k\right)\right)\right)}\right)\\
\end{array}
\end{array}
if k < 1.02e7Initial program 54.7%
*-commutative54.7%
associate-*l*48.6%
associate-*r*48.6%
+-commutative48.6%
associate-+r+48.6%
metadata-eval48.6%
Simplified48.6%
Taylor expanded in k around 0 49.6%
associate-/l*49.2%
unpow249.2%
unpow249.2%
associate-*r/56.9%
times-frac66.7%
Simplified66.7%
expm1-log1p-u44.1%
expm1-udef41.4%
associate-/r*41.4%
metadata-eval41.4%
associate-/r/41.9%
Applied egg-rr41.9%
expm1-def46.3%
expm1-log1p69.0%
associate-/r*69.0%
*-commutative69.0%
Simplified69.0%
Taylor expanded in k around 0 69.0%
if 1.02e7 < k Initial program 46.9%
associate-/l/47.0%
associate-*l/46.9%
associate-*l/46.9%
associate-/r/43.9%
*-commutative43.9%
associate-/l/43.9%
associate-*r*43.9%
*-commutative43.9%
associate-*r*43.9%
*-commutative43.9%
Simplified43.9%
Taylor expanded in k around inf 70.0%
unpow270.0%
*-commutative70.0%
Simplified70.0%
expm1-log1p-u60.2%
expm1-udef54.2%
associate-*l*59.2%
Applied egg-rr59.2%
expm1-def68.2%
expm1-log1p79.7%
associate-*l*84.4%
Simplified84.4%
Final simplification72.7%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (if (or (<= t -1.3e-55) (not (<= t 2.15e-72))) (* (/ l (pow t 3.0)) (/ l (* k k))) (* 2.0 (* (/ l t) (/ l (pow k 4.0))))))
k = abs(k);
double code(double t, double l, double k) {
double tmp;
if ((t <= -1.3e-55) || !(t <= 2.15e-72)) {
tmp = (l / pow(t, 3.0)) * (l / (k * k));
} else {
tmp = 2.0 * ((l / t) * (l / pow(k, 4.0)));
}
return tmp;
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: tmp
if ((t <= (-1.3d-55)) .or. (.not. (t <= 2.15d-72))) then
tmp = (l / (t ** 3.0d0)) * (l / (k * k))
else
tmp = 2.0d0 * ((l / t) * (l / (k ** 4.0d0)))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double tmp;
if ((t <= -1.3e-55) || !(t <= 2.15e-72)) {
tmp = (l / Math.pow(t, 3.0)) * (l / (k * k));
} else {
tmp = 2.0 * ((l / t) * (l / Math.pow(k, 4.0)));
}
return tmp;
}
k = abs(k) def code(t, l, k): tmp = 0 if (t <= -1.3e-55) or not (t <= 2.15e-72): tmp = (l / math.pow(t, 3.0)) * (l / (k * k)) else: tmp = 2.0 * ((l / t) * (l / math.pow(k, 4.0))) return tmp
k = abs(k) function code(t, l, k) tmp = 0.0 if ((t <= -1.3e-55) || !(t <= 2.15e-72)) tmp = Float64(Float64(l / (t ^ 3.0)) * Float64(l / Float64(k * k))); else tmp = Float64(2.0 * Float64(Float64(l / t) * Float64(l / (k ^ 4.0)))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) tmp = 0.0; if ((t <= -1.3e-55) || ~((t <= 2.15e-72))) tmp = (l / (t ^ 3.0)) * (l / (k * k)); else tmp = 2.0 * ((l / t) * (l / (k ^ 4.0))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function code[t_, l_, k_] := If[Or[LessEqual[t, -1.3e-55], N[Not[LessEqual[t, 2.15e-72]], $MachinePrecision]], N[(N[(l / N[Power[t, 3.0], $MachinePrecision]), $MachinePrecision] * N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(l / t), $MachinePrecision] * N[(l / N[Power[k, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.3 \cdot 10^{-55} \lor \neg \left(t \leq 2.15 \cdot 10^{-72}\right):\\
\;\;\;\;\frac{\ell}{{t}^{3}} \cdot \frac{\ell}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}\right)\\
\end{array}
\end{array}
if t < -1.2999999999999999e-55 or 2.1499999999999999e-72 < t Initial program 62.3%
associate-*l*62.3%
associate-/l/62.3%
*-commutative62.3%
associate-*r/65.5%
associate-/l*62.7%
associate-/r/54.6%
Simplified62.0%
Taylor expanded in k around 0 50.0%
unpow250.0%
*-commutative50.0%
times-frac57.0%
unpow257.0%
Simplified57.0%
if -1.2999999999999999e-55 < t < 2.1499999999999999e-72Initial program 38.5%
associate-/l/38.5%
associate-*l/38.5%
associate-*l/38.5%
associate-/r/38.4%
*-commutative38.4%
associate-/l/38.4%
associate-*r*38.4%
*-commutative38.4%
associate-*r*38.4%
*-commutative38.4%
Simplified38.4%
Taylor expanded in k around inf 67.4%
unpow267.4%
*-commutative67.4%
Simplified67.4%
Taylor expanded in k around 0 56.0%
unpow256.0%
*-commutative56.0%
Simplified56.0%
Taylor expanded in l around 0 56.0%
unpow256.0%
*-commutative56.0%
times-frac68.7%
Simplified68.7%
Final simplification61.6%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (if (or (<= t -5200.0) (not (<= t 3.1e-47))) (/ (* l (/ l (pow t 3.0))) (* k k)) (* 2.0 (* (/ l t) (/ l (pow k 4.0))))))
k = abs(k);
double code(double t, double l, double k) {
double tmp;
if ((t <= -5200.0) || !(t <= 3.1e-47)) {
tmp = (l * (l / pow(t, 3.0))) / (k * k);
} else {
tmp = 2.0 * ((l / t) * (l / pow(k, 4.0)));
}
return tmp;
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: tmp
if ((t <= (-5200.0d0)) .or. (.not. (t <= 3.1d-47))) then
tmp = (l * (l / (t ** 3.0d0))) / (k * k)
else
tmp = 2.0d0 * ((l / t) * (l / (k ** 4.0d0)))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double tmp;
if ((t <= -5200.0) || !(t <= 3.1e-47)) {
tmp = (l * (l / Math.pow(t, 3.0))) / (k * k);
} else {
tmp = 2.0 * ((l / t) * (l / Math.pow(k, 4.0)));
}
return tmp;
}
k = abs(k) def code(t, l, k): tmp = 0 if (t <= -5200.0) or not (t <= 3.1e-47): tmp = (l * (l / math.pow(t, 3.0))) / (k * k) else: tmp = 2.0 * ((l / t) * (l / math.pow(k, 4.0))) return tmp
k = abs(k) function code(t, l, k) tmp = 0.0 if ((t <= -5200.0) || !(t <= 3.1e-47)) tmp = Float64(Float64(l * Float64(l / (t ^ 3.0))) / Float64(k * k)); else tmp = Float64(2.0 * Float64(Float64(l / t) * Float64(l / (k ^ 4.0)))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) tmp = 0.0; if ((t <= -5200.0) || ~((t <= 3.1e-47))) tmp = (l * (l / (t ^ 3.0))) / (k * k); else tmp = 2.0 * ((l / t) * (l / (k ^ 4.0))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function code[t_, l_, k_] := If[Or[LessEqual[t, -5200.0], N[Not[LessEqual[t, 3.1e-47]], $MachinePrecision]], N[(N[(l * N[(l / N[Power[t, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(l / t), $MachinePrecision] * N[(l / N[Power[k, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5200 \lor \neg \left(t \leq 3.1 \cdot 10^{-47}\right):\\
\;\;\;\;\frac{\ell \cdot \frac{\ell}{{t}^{3}}}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}\right)\\
\end{array}
\end{array}
if t < -5200 or 3.0999999999999998e-47 < t Initial program 60.6%
associate-*l*60.6%
associate-/l/60.6%
*-commutative60.6%
associate-*r/64.3%
associate-/l*61.0%
associate-/r/52.2%
Simplified60.1%
Taylor expanded in k around 0 49.8%
unpow249.8%
*-commutative49.8%
times-frac56.0%
unpow256.0%
Simplified56.0%
associate-*r/57.2%
Applied egg-rr57.2%
if -5200 < t < 3.0999999999999998e-47Initial program 43.4%
associate-/l/43.4%
associate-*l/43.3%
associate-*l/43.3%
associate-/r/43.3%
*-commutative43.3%
associate-/l/43.3%
associate-*r*43.3%
*-commutative43.3%
associate-*r*43.3%
*-commutative43.3%
Simplified43.3%
Taylor expanded in k around inf 68.3%
unpow268.3%
*-commutative68.3%
Simplified68.3%
Taylor expanded in k around 0 56.7%
unpow256.7%
*-commutative56.7%
Simplified56.7%
Taylor expanded in l around 0 56.7%
unpow256.7%
*-commutative56.7%
times-frac67.9%
Simplified67.9%
Final simplification62.0%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (if (or (<= t -7.2e-118) (not (<= t 2.5e-70))) (/ (/ l k) (* (pow t 3.0) (/ k l))) (* 2.0 (* (/ l t) (/ l (pow k 4.0))))))
k = abs(k);
double code(double t, double l, double k) {
double tmp;
if ((t <= -7.2e-118) || !(t <= 2.5e-70)) {
tmp = (l / k) / (pow(t, 3.0) * (k / l));
} else {
tmp = 2.0 * ((l / t) * (l / pow(k, 4.0)));
}
return tmp;
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8) :: tmp
if ((t <= (-7.2d-118)) .or. (.not. (t <= 2.5d-70))) then
tmp = (l / k) / ((t ** 3.0d0) * (k / l))
else
tmp = 2.0d0 * ((l / t) * (l / (k ** 4.0d0)))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double tmp;
if ((t <= -7.2e-118) || !(t <= 2.5e-70)) {
tmp = (l / k) / (Math.pow(t, 3.0) * (k / l));
} else {
tmp = 2.0 * ((l / t) * (l / Math.pow(k, 4.0)));
}
return tmp;
}
k = abs(k) def code(t, l, k): tmp = 0 if (t <= -7.2e-118) or not (t <= 2.5e-70): tmp = (l / k) / (math.pow(t, 3.0) * (k / l)) else: tmp = 2.0 * ((l / t) * (l / math.pow(k, 4.0))) return tmp
k = abs(k) function code(t, l, k) tmp = 0.0 if ((t <= -7.2e-118) || !(t <= 2.5e-70)) tmp = Float64(Float64(l / k) / Float64((t ^ 3.0) * Float64(k / l))); else tmp = Float64(2.0 * Float64(Float64(l / t) * Float64(l / (k ^ 4.0)))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) tmp = 0.0; if ((t <= -7.2e-118) || ~((t <= 2.5e-70))) tmp = (l / k) / ((t ^ 3.0) * (k / l)); else tmp = 2.0 * ((l / t) * (l / (k ^ 4.0))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function code[t_, l_, k_] := If[Or[LessEqual[t, -7.2e-118], N[Not[LessEqual[t, 2.5e-70]], $MachinePrecision]], N[(N[(l / k), $MachinePrecision] / N[(N[Power[t, 3.0], $MachinePrecision] * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(l / t), $MachinePrecision] * N[(l / N[Power[k, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.2 \cdot 10^{-118} \lor \neg \left(t \leq 2.5 \cdot 10^{-70}\right):\\
\;\;\;\;\frac{\frac{\ell}{k}}{{t}^{3} \cdot \frac{k}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}\right)\\
\end{array}
\end{array}
if t < -7.2000000000000004e-118 or 2.4999999999999999e-70 < t Initial program 61.0%
*-commutative61.0%
associate-*l*54.0%
associate-*r*54.0%
+-commutative54.0%
associate-+r+54.0%
metadata-eval54.0%
Simplified54.0%
Taylor expanded in k around 0 49.8%
associate-/l*49.8%
unpow249.8%
unpow249.8%
associate-*r/56.7%
times-frac67.5%
Simplified67.5%
expm1-log1p-u54.1%
expm1-udef50.5%
associate-/r*50.5%
metadata-eval50.5%
associate-/r/51.0%
Applied egg-rr51.0%
expm1-def56.6%
expm1-log1p70.1%
associate-/r*70.0%
*-commutative70.0%
Simplified70.0%
Taylor expanded in k around 0 70.1%
if -7.2000000000000004e-118 < t < 2.4999999999999999e-70Initial program 37.0%
associate-/l/37.0%
associate-*l/37.0%
associate-*l/37.0%
associate-/r/37.0%
*-commutative37.0%
associate-/l/37.0%
associate-*r*37.0%
*-commutative37.0%
associate-*r*37.0%
*-commutative37.0%
Simplified37.0%
Taylor expanded in k around inf 70.8%
unpow270.8%
*-commutative70.8%
Simplified70.8%
Taylor expanded in k around 0 57.6%
unpow257.6%
*-commutative57.6%
Simplified57.6%
Taylor expanded in l around 0 57.6%
unpow257.6%
*-commutative57.6%
times-frac70.9%
Simplified70.9%
Final simplification70.4%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (* 2.0 (* (/ l t) (/ l (pow k 4.0)))))
k = abs(k);
double code(double t, double l, double k) {
return 2.0 * ((l / t) * (l / pow(k, 4.0)));
}
NOTE: k should be positive before calling this function
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = 2.0d0 * ((l / t) * (l / (k ** 4.0d0)))
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
return 2.0 * ((l / t) * (l / Math.pow(k, 4.0)));
}
k = abs(k) def code(t, l, k): return 2.0 * ((l / t) * (l / math.pow(k, 4.0)))
k = abs(k) function code(t, l, k) return Float64(2.0 * Float64(Float64(l / t) * Float64(l / (k ^ 4.0)))) end
k = abs(k) function tmp = code(t, l, k) tmp = 2.0 * ((l / t) * (l / (k ^ 4.0))); end
NOTE: k should be positive before calling this function code[t_, l_, k_] := N[(2.0 * N[(N[(l / t), $MachinePrecision] * N[(l / N[Power[k, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
2 \cdot \left(\frac{\ell}{t} \cdot \frac{\ell}{{k}^{4}}\right)
\end{array}
Initial program 52.8%
associate-/l/52.8%
associate-*l/54.8%
associate-*l/53.2%
associate-/r/52.4%
*-commutative52.4%
associate-/l/52.4%
associate-*r*52.4%
*-commutative52.4%
associate-*r*52.4%
*-commutative52.4%
Simplified52.4%
Taylor expanded in k around inf 52.4%
unpow252.4%
*-commutative52.4%
Simplified52.4%
Taylor expanded in k around 0 44.4%
unpow244.4%
*-commutative44.4%
Simplified44.4%
Taylor expanded in l around 0 44.4%
unpow244.4%
*-commutative44.4%
times-frac51.0%
Simplified51.0%
Final simplification51.0%
herbie shell --seed 2023238
(FPCore (t l k)
:name "Toniolo and Linder, Equation (10+)"
:precision binary64
(/ 2.0 (* (* (* (/ (pow t 3.0) (* l l)) (sin k)) (tan k)) (+ (+ 1.0 (pow (/ k t) 2.0)) 1.0))))