
(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 9 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
(let* ((t_1 (/ (/ l k) k)))
(if (<= k 2e-98)
(* t_1 (* 2.0 (/ t_1 t)))
(* (* 2.0 (/ (/ (/ l k) t) k)) (/ l (* (sin k) (tan k)))))))k = abs(k);
double code(double t, double l, double k) {
double t_1 = (l / k) / k;
double tmp;
if (k <= 2e-98) {
tmp = t_1 * (2.0 * (t_1 / t));
} else {
tmp = (2.0 * (((l / k) / t) / k)) * (l / (sin(k) * tan(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) :: t_1
real(8) :: tmp
t_1 = (l / k) / k
if (k <= 2d-98) then
tmp = t_1 * (2.0d0 * (t_1 / t))
else
tmp = (2.0d0 * (((l / k) / t) / k)) * (l / (sin(k) * tan(k)))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double t_1 = (l / k) / k;
double tmp;
if (k <= 2e-98) {
tmp = t_1 * (2.0 * (t_1 / t));
} else {
tmp = (2.0 * (((l / k) / t) / k)) * (l / (Math.sin(k) * Math.tan(k)));
}
return tmp;
}
k = abs(k) def code(t, l, k): t_1 = (l / k) / k tmp = 0 if k <= 2e-98: tmp = t_1 * (2.0 * (t_1 / t)) else: tmp = (2.0 * (((l / k) / t) / k)) * (l / (math.sin(k) * math.tan(k))) return tmp
k = abs(k) function code(t, l, k) t_1 = Float64(Float64(l / k) / k) tmp = 0.0 if (k <= 2e-98) tmp = Float64(t_1 * Float64(2.0 * Float64(t_1 / t))); else tmp = Float64(Float64(2.0 * Float64(Float64(Float64(l / k) / t) / k)) * Float64(l / Float64(sin(k) * tan(k)))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) t_1 = (l / k) / k; tmp = 0.0; if (k <= 2e-98) tmp = t_1 * (2.0 * (t_1 / t)); else tmp = (2.0 * (((l / k) / t) / k)) * (l / (sin(k) * tan(k))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(l / k), $MachinePrecision] / k), $MachinePrecision]}, If[LessEqual[k, 2e-98], N[(t$95$1 * N[(2.0 * N[(t$95$1 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[(N[(N[(l / k), $MachinePrecision] / t), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision] * N[(l / N[(N[Sin[k], $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
t_1 := \frac{\frac{\ell}{k}}{k}\\
\mathbf{if}\;k \leq 2 \cdot 10^{-98}:\\
\;\;\;\;t_1 \cdot \left(2 \cdot \frac{t_1}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(2 \cdot \frac{\frac{\frac{\ell}{k}}{t}}{k}\right) \cdot \frac{\ell}{\sin k \cdot \tan k}\\
\end{array}
\end{array}
if k < 1.99999999999999988e-98Initial program 36.0%
associate-*l*36.0%
associate-*l*36.0%
associate-/r*36.0%
associate-/r/36.0%
*-commutative36.0%
times-frac36.7%
+-commutative36.7%
associate--l+42.5%
metadata-eval42.5%
+-rgt-identity42.5%
times-frac47.2%
Simplified47.2%
clear-num47.2%
frac-times42.5%
frac-times42.5%
*-un-lft-identity42.5%
div-inv42.5%
pow-flip42.5%
metadata-eval42.5%
Applied egg-rr42.5%
times-frac47.4%
Simplified47.4%
Taylor expanded in l around 0 84.0%
associate-/r*85.9%
unpow285.9%
associate-/r*91.2%
Simplified91.2%
Taylor expanded in k around 0 74.7%
unpow274.7%
associate-/r*77.1%
Simplified77.1%
if 1.99999999999999988e-98 < k Initial program 23.4%
associate-*l*23.4%
associate-*l*23.4%
associate-/r*23.4%
associate-/r/23.3%
*-commutative23.3%
times-frac23.4%
+-commutative23.4%
associate--l+37.4%
metadata-eval37.4%
+-rgt-identity37.4%
times-frac39.1%
Simplified39.1%
clear-num39.1%
frac-times37.4%
frac-times37.3%
*-un-lft-identity37.3%
div-inv37.3%
pow-flip38.8%
metadata-eval38.8%
Applied egg-rr38.8%
times-frac45.8%
Simplified45.8%
Taylor expanded in l around 0 84.5%
associate-/r*88.7%
unpow288.7%
associate-/r*93.0%
Simplified93.0%
Taylor expanded in l around 0 84.5%
*-commutative84.5%
unpow284.5%
associate-*r*86.4%
associate-/r*92.6%
associate-/l/96.5%
Simplified96.5%
Final simplification84.7%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (* (/ l (* (sin k) (tan k))) (* 2.0 (/ (/ l (* k k)) t))))
k = abs(k);
double code(double t, double l, double k) {
return (l / (sin(k) * tan(k))) * (2.0 * ((l / (k * k)) / t));
}
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 = (l / (sin(k) * tan(k))) * (2.0d0 * ((l / (k * k)) / t))
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
return (l / (Math.sin(k) * Math.tan(k))) * (2.0 * ((l / (k * k)) / t));
}
k = abs(k) def code(t, l, k): return (l / (math.sin(k) * math.tan(k))) * (2.0 * ((l / (k * k)) / t))
k = abs(k) function code(t, l, k) return Float64(Float64(l / Float64(sin(k) * tan(k))) * Float64(2.0 * Float64(Float64(l / Float64(k * k)) / t))) end
k = abs(k) function tmp = code(t, l, k) tmp = (l / (sin(k) * tan(k))) * (2.0 * ((l / (k * k)) / t)); end
NOTE: k should be positive before calling this function code[t_, l_, k_] := N[(N[(l / N[(N[Sin[k], $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
\frac{\ell}{\sin k \cdot \tan k} \cdot \left(2 \cdot \frac{\frac{\ell}{k \cdot k}}{t}\right)
\end{array}
Initial program 31.1%
associate-*l*31.1%
associate-*l*31.1%
associate-/r*31.1%
associate-/r/31.1%
*-commutative31.1%
times-frac31.5%
+-commutative31.5%
associate--l+40.5%
metadata-eval40.5%
+-rgt-identity40.5%
times-frac44.0%
Simplified44.0%
clear-num44.0%
frac-times40.5%
frac-times40.5%
*-un-lft-identity40.5%
div-inv40.5%
pow-flip41.0%
metadata-eval41.0%
Applied egg-rr41.0%
times-frac46.8%
Simplified46.8%
Taylor expanded in l around 0 84.2%
associate-/r*87.0%
unpow287.0%
associate-/r*91.9%
Simplified91.9%
Taylor expanded in l around 0 84.2%
*-commutative84.2%
unpow284.2%
associate-*r*86.8%
associate-/r*92.8%
associate-/l/95.3%
Simplified95.3%
Taylor expanded in l around 0 84.2%
associate-/r*87.0%
unpow287.0%
Simplified87.0%
Final simplification87.0%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (* (* 2.0 (/ (/ (/ l k) k) t)) (/ l (* (sin k) (tan k)))))
k = abs(k);
double code(double t, double l, double k) {
return (2.0 * (((l / k) / k) / t)) * (l / (sin(k) * tan(k)));
}
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 / k) / k) / t)) * (l / (sin(k) * tan(k)))
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
return (2.0 * (((l / k) / k) / t)) * (l / (Math.sin(k) * Math.tan(k)));
}
k = abs(k) def code(t, l, k): return (2.0 * (((l / k) / k) / t)) * (l / (math.sin(k) * math.tan(k)))
k = abs(k) function code(t, l, k) return Float64(Float64(2.0 * Float64(Float64(Float64(l / k) / k) / t)) * Float64(l / Float64(sin(k) * tan(k)))) end
k = abs(k) function tmp = code(t, l, k) tmp = (2.0 * (((l / k) / k) / t)) * (l / (sin(k) * tan(k))); end
NOTE: k should be positive before calling this function code[t_, l_, k_] := N[(N[(2.0 * N[(N[(N[(l / k), $MachinePrecision] / k), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] * N[(l / N[(N[Sin[k], $MachinePrecision] * N[Tan[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
\left(2 \cdot \frac{\frac{\frac{\ell}{k}}{k}}{t}\right) \cdot \frac{\ell}{\sin k \cdot \tan k}
\end{array}
Initial program 31.1%
associate-*l*31.1%
associate-*l*31.1%
associate-/r*31.1%
associate-/r/31.1%
*-commutative31.1%
times-frac31.5%
+-commutative31.5%
associate--l+40.5%
metadata-eval40.5%
+-rgt-identity40.5%
times-frac44.0%
Simplified44.0%
clear-num44.0%
frac-times40.5%
frac-times40.5%
*-un-lft-identity40.5%
div-inv40.5%
pow-flip41.0%
metadata-eval41.0%
Applied egg-rr41.0%
times-frac46.8%
Simplified46.8%
Taylor expanded in l around 0 84.2%
associate-/r*87.0%
unpow287.0%
associate-/r*91.9%
Simplified91.9%
Final simplification91.9%
NOTE: k should be positive before calling this function
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ (/ l k) k)))
(if (<= l 2.8e+202)
(* t_1 (* 2.0 (/ t_1 t)))
(*
2.0
(/ (+ -0.16666666666666666 (/ 1.0 (* k k))) (/ t (pow (/ l k) 2.0)))))))k = abs(k);
double code(double t, double l, double k) {
double t_1 = (l / k) / k;
double tmp;
if (l <= 2.8e+202) {
tmp = t_1 * (2.0 * (t_1 / t));
} else {
tmp = 2.0 * ((-0.16666666666666666 + (1.0 / (k * k))) / (t / pow((l / k), 2.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) :: t_1
real(8) :: tmp
t_1 = (l / k) / k
if (l <= 2.8d+202) then
tmp = t_1 * (2.0d0 * (t_1 / t))
else
tmp = 2.0d0 * (((-0.16666666666666666d0) + (1.0d0 / (k * k))) / (t / ((l / k) ** 2.0d0)))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double t_1 = (l / k) / k;
double tmp;
if (l <= 2.8e+202) {
tmp = t_1 * (2.0 * (t_1 / t));
} else {
tmp = 2.0 * ((-0.16666666666666666 + (1.0 / (k * k))) / (t / Math.pow((l / k), 2.0)));
}
return tmp;
}
k = abs(k) def code(t, l, k): t_1 = (l / k) / k tmp = 0 if l <= 2.8e+202: tmp = t_1 * (2.0 * (t_1 / t)) else: tmp = 2.0 * ((-0.16666666666666666 + (1.0 / (k * k))) / (t / math.pow((l / k), 2.0))) return tmp
k = abs(k) function code(t, l, k) t_1 = Float64(Float64(l / k) / k) tmp = 0.0 if (l <= 2.8e+202) tmp = Float64(t_1 * Float64(2.0 * Float64(t_1 / t))); else tmp = Float64(2.0 * Float64(Float64(-0.16666666666666666 + Float64(1.0 / Float64(k * k))) / Float64(t / (Float64(l / k) ^ 2.0)))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) t_1 = (l / k) / k; tmp = 0.0; if (l <= 2.8e+202) tmp = t_1 * (2.0 * (t_1 / t)); else tmp = 2.0 * ((-0.16666666666666666 + (1.0 / (k * k))) / (t / ((l / k) ^ 2.0))); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(l / k), $MachinePrecision] / k), $MachinePrecision]}, If[LessEqual[l, 2.8e+202], N[(t$95$1 * N[(2.0 * N[(t$95$1 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(-0.16666666666666666 + N[(1.0 / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t / N[Power[N[(l / k), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
t_1 := \frac{\frac{\ell}{k}}{k}\\
\mathbf{if}\;\ell \leq 2.8 \cdot 10^{+202}:\\
\;\;\;\;t_1 \cdot \left(2 \cdot \frac{t_1}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{-0.16666666666666666 + \frac{1}{k \cdot k}}{\frac{t}{{\left(\frac{\ell}{k}\right)}^{2}}}\\
\end{array}
\end{array}
if l < 2.80000000000000016e202Initial program 31.1%
associate-*l*31.0%
associate-*l*31.1%
associate-/r*31.1%
associate-/r/31.0%
*-commutative31.0%
times-frac31.5%
+-commutative31.5%
associate--l+41.1%
metadata-eval41.1%
+-rgt-identity41.1%
times-frac44.9%
Simplified44.9%
clear-num44.8%
frac-times41.1%
frac-times41.0%
*-un-lft-identity41.0%
div-inv41.0%
pow-flip41.6%
metadata-eval41.6%
Applied egg-rr41.6%
times-frac47.3%
Simplified47.3%
Taylor expanded in l around 0 85.6%
associate-/r*88.1%
unpow288.1%
associate-/r*92.0%
Simplified92.0%
Taylor expanded in k around 0 75.2%
unpow275.2%
associate-/r*76.8%
Simplified76.8%
if 2.80000000000000016e202 < l Initial program 31.6%
associate-*l*31.6%
associate-*l*31.6%
associate-/r*31.6%
associate-/r/31.6%
*-commutative31.6%
times-frac31.6%
+-commutative31.6%
associate--l+31.6%
metadata-eval31.6%
+-rgt-identity31.6%
times-frac31.6%
Simplified31.6%
Taylor expanded in t around 0 56.6%
associate-/r*56.6%
unpow256.6%
associate-/r*56.6%
Simplified56.6%
Taylor expanded in k around 0 0.0%
fma-def0.0%
unpow20.0%
unpow20.0%
unpow20.0%
Simplified0.0%
Taylor expanded in t around 0 0.0%
associate-*r/0.0%
fma-def0.0%
unpow20.0%
unpow20.0%
unpow20.0%
times-frac0.0%
unpow20.0%
associate-/l*0.0%
fma-def0.0%
+-commutative0.0%
unpow20.0%
times-frac0.0%
unpow20.0%
unpow20.0%
*-rgt-identity0.0%
associate-*r/0.0%
unpow20.0%
*-commutative0.0%
Simplified60.8%
Final simplification75.8%
NOTE: k should be positive before calling this function
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ (/ l k) k)) (t_2 (* 2.0 (/ t_1 t))))
(if (<= l 2.8e+174)
(* t_1 t_2)
(* t_2 (+ (/ l (* k k)) (* l -0.16666666666666666))))))k = abs(k);
double code(double t, double l, double k) {
double t_1 = (l / k) / k;
double t_2 = 2.0 * (t_1 / t);
double tmp;
if (l <= 2.8e+174) {
tmp = t_1 * t_2;
} else {
tmp = t_2 * ((l / (k * k)) + (l * -0.16666666666666666));
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (l / k) / k
t_2 = 2.0d0 * (t_1 / t)
if (l <= 2.8d+174) then
tmp = t_1 * t_2
else
tmp = t_2 * ((l / (k * k)) + (l * (-0.16666666666666666d0)))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double t_1 = (l / k) / k;
double t_2 = 2.0 * (t_1 / t);
double tmp;
if (l <= 2.8e+174) {
tmp = t_1 * t_2;
} else {
tmp = t_2 * ((l / (k * k)) + (l * -0.16666666666666666));
}
return tmp;
}
k = abs(k) def code(t, l, k): t_1 = (l / k) / k t_2 = 2.0 * (t_1 / t) tmp = 0 if l <= 2.8e+174: tmp = t_1 * t_2 else: tmp = t_2 * ((l / (k * k)) + (l * -0.16666666666666666)) return tmp
k = abs(k) function code(t, l, k) t_1 = Float64(Float64(l / k) / k) t_2 = Float64(2.0 * Float64(t_1 / t)) tmp = 0.0 if (l <= 2.8e+174) tmp = Float64(t_1 * t_2); else tmp = Float64(t_2 * Float64(Float64(l / Float64(k * k)) + Float64(l * -0.16666666666666666))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) t_1 = (l / k) / k; t_2 = 2.0 * (t_1 / t); tmp = 0.0; if (l <= 2.8e+174) tmp = t_1 * t_2; else tmp = t_2 * ((l / (k * k)) + (l * -0.16666666666666666)); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(l / k), $MachinePrecision] / k), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(t$95$1 / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 2.8e+174], N[(t$95$1 * t$95$2), $MachinePrecision], N[(t$95$2 * N[(N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision] + N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
t_1 := \frac{\frac{\ell}{k}}{k}\\
t_2 := 2 \cdot \frac{t_1}{t}\\
\mathbf{if}\;\ell \leq 2.8 \cdot 10^{+174}:\\
\;\;\;\;t_1 \cdot t_2\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(\frac{\ell}{k \cdot k} + \ell \cdot -0.16666666666666666\right)\\
\end{array}
\end{array}
if l < 2.7999999999999999e174Initial program 31.6%
associate-*l*31.6%
associate-*l*31.6%
associate-/r*31.6%
associate-/r/31.6%
*-commutative31.6%
times-frac32.0%
+-commutative32.0%
associate--l+41.8%
metadata-eval41.8%
+-rgt-identity41.8%
times-frac45.6%
Simplified45.6%
clear-num45.6%
frac-times41.8%
frac-times41.7%
*-un-lft-identity41.7%
div-inv41.7%
pow-flip42.4%
metadata-eval42.4%
Applied egg-rr42.4%
times-frac48.1%
Simplified48.1%
Taylor expanded in l around 0 86.1%
associate-/r*88.3%
unpow288.3%
associate-/r*91.9%
Simplified91.9%
Taylor expanded in k around 0 75.9%
unpow275.9%
associate-/r*77.5%
Simplified77.5%
if 2.7999999999999999e174 < l Initial program 25.3%
associate-*l*25.3%
associate-*l*25.3%
associate-/r*25.3%
associate-/r/25.3%
*-commutative25.3%
times-frac25.3%
+-commutative25.3%
associate--l+25.3%
metadata-eval25.3%
+-rgt-identity25.3%
times-frac25.3%
Simplified25.3%
clear-num25.3%
frac-times25.3%
frac-times25.3%
*-un-lft-identity25.3%
div-inv25.3%
pow-flip25.3%
metadata-eval25.3%
Applied egg-rr25.3%
times-frac31.1%
Simplified31.1%
Taylor expanded in l around 0 61.2%
associate-/r*71.0%
unpow271.0%
associate-/r*92.2%
Simplified92.2%
Taylor expanded in k around 0 47.1%
unpow247.1%
*-commutative47.1%
Simplified47.1%
Final simplification75.1%
NOTE: k should be positive before calling this function
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ (/ l k) k)))
(if (<= k 1.55e+53)
(* t_1 (* 2.0 (/ t_1 t)))
(*
(* 2.0 (/ (/ (/ l k) t) k))
(+ (/ l (* k k)) (* l -0.16666666666666666))))))k = abs(k);
double code(double t, double l, double k) {
double t_1 = (l / k) / k;
double tmp;
if (k <= 1.55e+53) {
tmp = t_1 * (2.0 * (t_1 / t));
} else {
tmp = (2.0 * (((l / k) / t) / k)) * ((l / (k * k)) + (l * -0.16666666666666666));
}
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) :: t_1
real(8) :: tmp
t_1 = (l / k) / k
if (k <= 1.55d+53) then
tmp = t_1 * (2.0d0 * (t_1 / t))
else
tmp = (2.0d0 * (((l / k) / t) / k)) * ((l / (k * k)) + (l * (-0.16666666666666666d0)))
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double t_1 = (l / k) / k;
double tmp;
if (k <= 1.55e+53) {
tmp = t_1 * (2.0 * (t_1 / t));
} else {
tmp = (2.0 * (((l / k) / t) / k)) * ((l / (k * k)) + (l * -0.16666666666666666));
}
return tmp;
}
k = abs(k) def code(t, l, k): t_1 = (l / k) / k tmp = 0 if k <= 1.55e+53: tmp = t_1 * (2.0 * (t_1 / t)) else: tmp = (2.0 * (((l / k) / t) / k)) * ((l / (k * k)) + (l * -0.16666666666666666)) return tmp
k = abs(k) function code(t, l, k) t_1 = Float64(Float64(l / k) / k) tmp = 0.0 if (k <= 1.55e+53) tmp = Float64(t_1 * Float64(2.0 * Float64(t_1 / t))); else tmp = Float64(Float64(2.0 * Float64(Float64(Float64(l / k) / t) / k)) * Float64(Float64(l / Float64(k * k)) + Float64(l * -0.16666666666666666))); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) t_1 = (l / k) / k; tmp = 0.0; if (k <= 1.55e+53) tmp = t_1 * (2.0 * (t_1 / t)); else tmp = (2.0 * (((l / k) / t) / k)) * ((l / (k * k)) + (l * -0.16666666666666666)); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(l / k), $MachinePrecision] / k), $MachinePrecision]}, If[LessEqual[k, 1.55e+53], N[(t$95$1 * N[(2.0 * N[(t$95$1 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[(N[(N[(l / k), $MachinePrecision] / t), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision] * N[(N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision] + N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
t_1 := \frac{\frac{\ell}{k}}{k}\\
\mathbf{if}\;k \leq 1.55 \cdot 10^{+53}:\\
\;\;\;\;t_1 \cdot \left(2 \cdot \frac{t_1}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(2 \cdot \frac{\frac{\frac{\ell}{k}}{t}}{k}\right) \cdot \left(\frac{\ell}{k \cdot k} + \ell \cdot -0.16666666666666666\right)\\
\end{array}
\end{array}
if k < 1.5500000000000001e53Initial program 32.1%
associate-*l*32.1%
associate-*l*32.1%
associate-/r*32.1%
associate-/r/32.1%
*-commutative32.1%
times-frac32.7%
+-commutative32.7%
associate--l+40.5%
metadata-eval40.5%
+-rgt-identity40.5%
times-frac45.3%
Simplified45.3%
clear-num45.3%
frac-times40.5%
frac-times40.5%
*-un-lft-identity40.5%
div-inv40.5%
pow-flip41.0%
metadata-eval41.0%
Applied egg-rr41.0%
times-frac46.0%
Simplified46.0%
Taylor expanded in l around 0 85.9%
associate-/r*88.1%
unpow288.1%
associate-/r*92.5%
Simplified92.5%
Taylor expanded in k around 0 75.8%
unpow275.8%
associate-/r*77.8%
Simplified77.8%
if 1.5500000000000001e53 < k Initial program 28.1%
associate-*l*28.1%
associate-*l*28.1%
associate-/r*28.1%
associate-/r/28.0%
*-commutative28.0%
times-frac28.0%
+-commutative28.0%
associate--l+40.4%
metadata-eval40.4%
+-rgt-identity40.4%
times-frac40.4%
Simplified40.4%
clear-num40.4%
frac-times40.4%
frac-times40.4%
*-un-lft-identity40.4%
div-inv40.4%
pow-flip41.1%
metadata-eval41.1%
Applied egg-rr41.1%
times-frac48.9%
Simplified48.9%
Taylor expanded in l around 0 79.2%
associate-/r*83.7%
unpow283.7%
associate-/r*90.4%
Simplified90.4%
Taylor expanded in l around 0 79.2%
*-commutative79.2%
unpow279.2%
associate-*r*82.1%
associate-/r*91.7%
associate-/l/94.7%
Simplified94.7%
Taylor expanded in k around 0 65.3%
unpow264.8%
*-commutative64.8%
Simplified65.3%
Final simplification74.6%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (if (<= k 210000000.0) (* (* 2.0 (/ (/ (/ l k) k) t)) (/ l (* k k))) (* -0.3333333333333333 (/ (* (/ l k) (/ l k)) t))))
k = abs(k);
double code(double t, double l, double k) {
double tmp;
if (k <= 210000000.0) {
tmp = (2.0 * (((l / k) / k) / t)) * (l / (k * k));
} else {
tmp = -0.3333333333333333 * (((l / k) * (l / k)) / t);
}
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 <= 210000000.0d0) then
tmp = (2.0d0 * (((l / k) / k) / t)) * (l / (k * k))
else
tmp = (-0.3333333333333333d0) * (((l / k) * (l / k)) / t)
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double tmp;
if (k <= 210000000.0) {
tmp = (2.0 * (((l / k) / k) / t)) * (l / (k * k));
} else {
tmp = -0.3333333333333333 * (((l / k) * (l / k)) / t);
}
return tmp;
}
k = abs(k) def code(t, l, k): tmp = 0 if k <= 210000000.0: tmp = (2.0 * (((l / k) / k) / t)) * (l / (k * k)) else: tmp = -0.3333333333333333 * (((l / k) * (l / k)) / t) return tmp
k = abs(k) function code(t, l, k) tmp = 0.0 if (k <= 210000000.0) tmp = Float64(Float64(2.0 * Float64(Float64(Float64(l / k) / k) / t)) * Float64(l / Float64(k * k))); else tmp = Float64(-0.3333333333333333 * Float64(Float64(Float64(l / k) * Float64(l / k)) / t)); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 210000000.0) tmp = (2.0 * (((l / k) / k) / t)) * (l / (k * k)); else tmp = -0.3333333333333333 * (((l / k) * (l / k)) / t); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function code[t_, l_, k_] := If[LessEqual[k, 210000000.0], N[(N[(2.0 * N[(N[(N[(l / k), $MachinePrecision] / k), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] * N[(l / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
\mathbf{if}\;k \leq 210000000:\\
\;\;\;\;\left(2 \cdot \frac{\frac{\frac{\ell}{k}}{k}}{t}\right) \cdot \frac{\ell}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{t}\\
\end{array}
\end{array}
if k < 2.1e8Initial program 33.3%
associate-*l*33.3%
associate-*l*33.3%
associate-/r*33.3%
associate-/r/33.3%
*-commutative33.3%
times-frac33.9%
+-commutative33.9%
associate--l+41.6%
metadata-eval41.6%
+-rgt-identity41.6%
times-frac46.6%
Simplified46.6%
clear-num46.6%
frac-times41.6%
frac-times41.6%
*-un-lft-identity41.6%
div-inv41.6%
pow-flip42.1%
metadata-eval42.1%
Applied egg-rr42.1%
times-frac47.5%
Simplified47.5%
Taylor expanded in l around 0 85.1%
associate-/r*87.8%
unpow287.8%
associate-/r*92.4%
Simplified92.4%
Taylor expanded in k around 0 77.8%
unpow277.8%
Simplified77.8%
if 2.1e8 < k Initial program 25.7%
associate-*l*25.7%
associate-*l*25.7%
associate-/r*25.7%
associate-/r/25.6%
*-commutative25.6%
times-frac25.6%
+-commutative25.6%
associate--l+37.8%
metadata-eval37.8%
+-rgt-identity37.8%
times-frac37.7%
Simplified37.7%
Taylor expanded in t around 0 70.8%
associate-/r*70.9%
unpow270.9%
associate-/r*70.9%
Simplified70.9%
Taylor expanded in k around 0 55.6%
fma-def55.6%
unpow255.6%
unpow255.6%
unpow255.6%
Simplified55.6%
Taylor expanded in k around inf 55.8%
associate-/r*55.9%
unpow255.9%
unpow255.9%
times-frac60.4%
unpow260.4%
Simplified60.4%
unpow260.4%
Applied egg-rr60.4%
Final simplification72.7%
NOTE: k should be positive before calling this function
(FPCore (t l k)
:precision binary64
(let* ((t_1 (/ (/ l k) k)))
(if (<= k 210000000.0)
(* t_1 (* 2.0 (/ t_1 t)))
(* -0.3333333333333333 (/ (* (/ l k) (/ l k)) t)))))k = abs(k);
double code(double t, double l, double k) {
double t_1 = (l / k) / k;
double tmp;
if (k <= 210000000.0) {
tmp = t_1 * (2.0 * (t_1 / t));
} else {
tmp = -0.3333333333333333 * (((l / k) * (l / k)) / t);
}
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) :: t_1
real(8) :: tmp
t_1 = (l / k) / k
if (k <= 210000000.0d0) then
tmp = t_1 * (2.0d0 * (t_1 / t))
else
tmp = (-0.3333333333333333d0) * (((l / k) * (l / k)) / t)
end if
code = tmp
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
double t_1 = (l / k) / k;
double tmp;
if (k <= 210000000.0) {
tmp = t_1 * (2.0 * (t_1 / t));
} else {
tmp = -0.3333333333333333 * (((l / k) * (l / k)) / t);
}
return tmp;
}
k = abs(k) def code(t, l, k): t_1 = (l / k) / k tmp = 0 if k <= 210000000.0: tmp = t_1 * (2.0 * (t_1 / t)) else: tmp = -0.3333333333333333 * (((l / k) * (l / k)) / t) return tmp
k = abs(k) function code(t, l, k) t_1 = Float64(Float64(l / k) / k) tmp = 0.0 if (k <= 210000000.0) tmp = Float64(t_1 * Float64(2.0 * Float64(t_1 / t))); else tmp = Float64(-0.3333333333333333 * Float64(Float64(Float64(l / k) * Float64(l / k)) / t)); end return tmp end
k = abs(k) function tmp_2 = code(t, l, k) t_1 = (l / k) / k; tmp = 0.0; if (k <= 210000000.0) tmp = t_1 * (2.0 * (t_1 / t)); else tmp = -0.3333333333333333 * (((l / k) * (l / k)) / t); end tmp_2 = tmp; end
NOTE: k should be positive before calling this function
code[t_, l_, k_] := Block[{t$95$1 = N[(N[(l / k), $MachinePrecision] / k), $MachinePrecision]}, If[LessEqual[k, 210000000.0], N[(t$95$1 * N[(2.0 * N[(t$95$1 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.3333333333333333 * N[(N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
k = |k|\\
\\
\begin{array}{l}
t_1 := \frac{\frac{\ell}{k}}{k}\\
\mathbf{if}\;k \leq 210000000:\\
\;\;\;\;t_1 \cdot \left(2 \cdot \frac{t_1}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;-0.3333333333333333 \cdot \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{t}\\
\end{array}
\end{array}
if k < 2.1e8Initial program 33.3%
associate-*l*33.3%
associate-*l*33.3%
associate-/r*33.3%
associate-/r/33.3%
*-commutative33.3%
times-frac33.9%
+-commutative33.9%
associate--l+41.6%
metadata-eval41.6%
+-rgt-identity41.6%
times-frac46.6%
Simplified46.6%
clear-num46.6%
frac-times41.6%
frac-times41.6%
*-un-lft-identity41.6%
div-inv41.6%
pow-flip42.1%
metadata-eval42.1%
Applied egg-rr42.1%
times-frac47.5%
Simplified47.5%
Taylor expanded in l around 0 85.1%
associate-/r*87.8%
unpow287.8%
associate-/r*92.4%
Simplified92.4%
Taylor expanded in k around 0 77.8%
unpow277.8%
associate-/r*79.9%
Simplified79.9%
if 2.1e8 < k Initial program 25.7%
associate-*l*25.7%
associate-*l*25.7%
associate-/r*25.7%
associate-/r/25.6%
*-commutative25.6%
times-frac25.6%
+-commutative25.6%
associate--l+37.8%
metadata-eval37.8%
+-rgt-identity37.8%
times-frac37.7%
Simplified37.7%
Taylor expanded in t around 0 70.8%
associate-/r*70.9%
unpow270.9%
associate-/r*70.9%
Simplified70.9%
Taylor expanded in k around 0 55.6%
fma-def55.6%
unpow255.6%
unpow255.6%
unpow255.6%
Simplified55.6%
Taylor expanded in k around inf 55.8%
associate-/r*55.9%
unpow255.9%
unpow255.9%
times-frac60.4%
unpow260.4%
Simplified60.4%
unpow260.4%
Applied egg-rr60.4%
Final simplification74.2%
NOTE: k should be positive before calling this function (FPCore (t l k) :precision binary64 (* -0.3333333333333333 (/ (* (/ l k) (/ l k)) t)))
k = abs(k);
double code(double t, double l, double k) {
return -0.3333333333333333 * (((l / k) * (l / k)) / t);
}
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 = (-0.3333333333333333d0) * (((l / k) * (l / k)) / t)
end function
k = Math.abs(k);
public static double code(double t, double l, double k) {
return -0.3333333333333333 * (((l / k) * (l / k)) / t);
}
k = abs(k) def code(t, l, k): return -0.3333333333333333 * (((l / k) * (l / k)) / t)
k = abs(k) function code(t, l, k) return Float64(-0.3333333333333333 * Float64(Float64(Float64(l / k) * Float64(l / k)) / t)) end
k = abs(k) function tmp = code(t, l, k) tmp = -0.3333333333333333 * (((l / k) * (l / k)) / t); end
NOTE: k should be positive before calling this function code[t_, l_, k_] := N[(-0.3333333333333333 * N[(N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
k = |k|\\
\\
-0.3333333333333333 \cdot \frac{\frac{\ell}{k} \cdot \frac{\ell}{k}}{t}
\end{array}
Initial program 31.1%
associate-*l*31.1%
associate-*l*31.1%
associate-/r*31.1%
associate-/r/31.1%
*-commutative31.1%
times-frac31.5%
+-commutative31.5%
associate--l+40.5%
metadata-eval40.5%
+-rgt-identity40.5%
times-frac44.0%
Simplified44.0%
Taylor expanded in t around 0 79.4%
associate-/r*79.4%
unpow279.4%
associate-/r*79.4%
Simplified79.4%
Taylor expanded in k around 0 54.2%
fma-def54.2%
unpow254.2%
unpow254.2%
unpow254.2%
Simplified54.2%
Taylor expanded in k around inf 34.8%
associate-/r*34.9%
unpow234.9%
unpow234.9%
times-frac36.5%
unpow236.5%
Simplified36.5%
unpow236.5%
Applied egg-rr36.5%
Final simplification36.5%
herbie shell --seed 2023256
(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))))