
(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}
(FPCore (t l k) :precision binary64 (if (<= (* l l) 4e+201) (* (/ 2.0 k) (/ (/ l (* (sin k) (/ (tan k) l))) (* k t))) (* 2.0 (/ (cos k) (/ (* t (pow (sin k) 2.0)) (pow (/ l k) 2.0))))))
double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 4e+201) {
tmp = (2.0 / k) * ((l / (sin(k) * (tan(k) / l))) / (k * t));
} else {
tmp = 2.0 * (cos(k) / ((t * pow(sin(k), 2.0)) / pow((l / k), 2.0)));
}
return tmp;
}
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 ((l * l) <= 4d+201) then
tmp = (2.0d0 / k) * ((l / (sin(k) * (tan(k) / l))) / (k * t))
else
tmp = 2.0d0 * (cos(k) / ((t * (sin(k) ** 2.0d0)) / ((l / k) ** 2.0d0)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 4e+201) {
tmp = (2.0 / k) * ((l / (Math.sin(k) * (Math.tan(k) / l))) / (k * t));
} else {
tmp = 2.0 * (Math.cos(k) / ((t * Math.pow(Math.sin(k), 2.0)) / Math.pow((l / k), 2.0)));
}
return tmp;
}
def code(t, l, k): tmp = 0 if (l * l) <= 4e+201: tmp = (2.0 / k) * ((l / (math.sin(k) * (math.tan(k) / l))) / (k * t)) else: tmp = 2.0 * (math.cos(k) / ((t * math.pow(math.sin(k), 2.0)) / math.pow((l / k), 2.0))) return tmp
function code(t, l, k) tmp = 0.0 if (Float64(l * l) <= 4e+201) tmp = Float64(Float64(2.0 / k) * Float64(Float64(l / Float64(sin(k) * Float64(tan(k) / l))) / Float64(k * t))); else tmp = Float64(2.0 * Float64(cos(k) / Float64(Float64(t * (sin(k) ^ 2.0)) / (Float64(l / k) ^ 2.0)))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if ((l * l) <= 4e+201) tmp = (2.0 / k) * ((l / (sin(k) * (tan(k) / l))) / (k * t)); else tmp = 2.0 * (cos(k) / ((t * (sin(k) ^ 2.0)) / ((l / k) ^ 2.0))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[N[(l * l), $MachinePrecision], 4e+201], N[(N[(2.0 / k), $MachinePrecision] * N[(N[(l / N[(N[Sin[k], $MachinePrecision] * N[(N[Tan[k], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Cos[k], $MachinePrecision] / N[(N[(t * N[Power[N[Sin[k], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[N[(l / k), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq 4 \cdot 10^{+201}:\\
\;\;\;\;\frac{2}{k} \cdot \frac{\frac{\ell}{\sin k \cdot \frac{\tan k}{\ell}}}{k \cdot t}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\cos k}{\frac{t \cdot {\sin k}^{2}}{{\left(\frac{\ell}{k}\right)}^{2}}}\\
\end{array}
\end{array}
if (*.f64 l l) < 4.00000000000000015e201Initial program 35.5%
associate-*l*35.5%
associate-*l*35.6%
associate-/r*35.0%
associate-/r/35.0%
*-commutative35.0%
times-frac36.6%
+-commutative36.6%
associate--l+48.3%
metadata-eval48.3%
+-rgt-identity48.3%
times-frac55.6%
Simplified55.6%
Taylor expanded in t around 0 90.0%
unpow290.0%
Simplified90.0%
*-commutative90.0%
clear-num90.0%
frac-times90.0%
*-un-lft-identity90.0%
Applied egg-rr90.0%
associate-*r*92.0%
associate-*l/92.1%
clear-num91.7%
associate-*l/91.7%
associate-*r/91.7%
associate-*r/91.7%
associate-*l/91.7%
clear-num92.1%
*-commutative92.1%
Applied egg-rr92.1%
times-frac96.3%
Applied egg-rr96.3%
if 4.00000000000000015e201 < (*.f64 l l) Initial program 34.1%
associate-*l*34.1%
associate-*l*34.1%
associate-/r*34.1%
associate-/r/34.1%
*-commutative34.1%
times-frac35.3%
+-commutative35.3%
associate--l+35.3%
metadata-eval35.3%
+-rgt-identity35.3%
times-frac35.3%
Simplified35.3%
Taylor expanded in t around 0 63.0%
unpow263.0%
Simplified63.0%
associate-*l/63.0%
associate-*l*71.0%
Applied egg-rr71.0%
associate-*l/70.9%
associate-*r*81.1%
*-commutative81.1%
associate-*l/81.1%
associate-*r/81.1%
Simplified81.1%
clear-num81.1%
inv-pow81.1%
Applied egg-rr81.1%
unpow-181.1%
Simplified81.1%
Taylor expanded in l around 0 62.9%
associate-/l*62.9%
*-commutative62.9%
associate-/l*63.1%
*-commutative63.1%
unpow263.1%
unpow263.1%
times-frac93.6%
unpow293.6%
Simplified93.6%
Final simplification95.5%
(FPCore (t l k) :precision binary64 (if (<= (* l l) 1e+258) (* (/ 2.0 k) (/ (/ l (* (sin k) (/ (tan k) l))) (* k t))) (* (/ l (tan k)) (/ (/ 1.0 (/ (sin k) (* l 2.0))) (* k (* k t))))))
double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e+258) {
tmp = (2.0 / k) * ((l / (sin(k) * (tan(k) / l))) / (k * t));
} else {
tmp = (l / tan(k)) * ((1.0 / (sin(k) / (l * 2.0))) / (k * (k * t)));
}
return tmp;
}
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 ((l * l) <= 1d+258) then
tmp = (2.0d0 / k) * ((l / (sin(k) * (tan(k) / l))) / (k * t))
else
tmp = (l / tan(k)) * ((1.0d0 / (sin(k) / (l * 2.0d0))) / (k * (k * t)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e+258) {
tmp = (2.0 / k) * ((l / (Math.sin(k) * (Math.tan(k) / l))) / (k * t));
} else {
tmp = (l / Math.tan(k)) * ((1.0 / (Math.sin(k) / (l * 2.0))) / (k * (k * t)));
}
return tmp;
}
def code(t, l, k): tmp = 0 if (l * l) <= 1e+258: tmp = (2.0 / k) * ((l / (math.sin(k) * (math.tan(k) / l))) / (k * t)) else: tmp = (l / math.tan(k)) * ((1.0 / (math.sin(k) / (l * 2.0))) / (k * (k * t))) return tmp
function code(t, l, k) tmp = 0.0 if (Float64(l * l) <= 1e+258) tmp = Float64(Float64(2.0 / k) * Float64(Float64(l / Float64(sin(k) * Float64(tan(k) / l))) / Float64(k * t))); else tmp = Float64(Float64(l / tan(k)) * Float64(Float64(1.0 / Float64(sin(k) / Float64(l * 2.0))) / Float64(k * Float64(k * t)))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if ((l * l) <= 1e+258) tmp = (2.0 / k) * ((l / (sin(k) * (tan(k) / l))) / (k * t)); else tmp = (l / tan(k)) * ((1.0 / (sin(k) / (l * 2.0))) / (k * (k * t))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[N[(l * l), $MachinePrecision], 1e+258], N[(N[(2.0 / k), $MachinePrecision] * N[(N[(l / N[(N[Sin[k], $MachinePrecision] * N[(N[Tan[k], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(l / N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 / N[(N[Sin[k], $MachinePrecision] / N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq 10^{+258}:\\
\;\;\;\;\frac{2}{k} \cdot \frac{\frac{\ell}{\sin k \cdot \frac{\tan k}{\ell}}}{k \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{\tan k} \cdot \frac{\frac{1}{\frac{\sin k}{\ell \cdot 2}}}{k \cdot \left(k \cdot t\right)}\\
\end{array}
\end{array}
if (*.f64 l l) < 1.00000000000000006e258Initial program 36.0%
associate-*l*36.0%
associate-*l*36.0%
associate-/r*35.5%
associate-/r/35.5%
*-commutative35.5%
times-frac37.5%
+-commutative37.5%
associate--l+48.7%
metadata-eval48.7%
+-rgt-identity48.7%
times-frac55.6%
Simplified55.6%
Taylor expanded in t around 0 89.9%
unpow289.9%
Simplified89.9%
*-commutative89.9%
clear-num89.9%
frac-times90.0%
*-un-lft-identity90.0%
Applied egg-rr90.0%
associate-*r*91.9%
associate-*l/92.0%
clear-num91.6%
associate-*l/91.6%
associate-*r/91.6%
associate-*r/91.6%
associate-*l/91.6%
clear-num92.0%
*-commutative92.0%
Applied egg-rr92.0%
times-frac96.0%
Applied egg-rr96.0%
if 1.00000000000000006e258 < (*.f64 l l) Initial program 32.6%
associate-*l*32.6%
associate-*l*32.6%
associate-/r*32.6%
associate-/r/32.6%
*-commutative32.6%
times-frac32.5%
+-commutative32.5%
associate--l+32.5%
metadata-eval32.5%
+-rgt-identity32.5%
times-frac32.5%
Simplified32.5%
Taylor expanded in t around 0 59.5%
unpow259.5%
Simplified59.5%
associate-*l/59.5%
associate-*l*68.5%
Applied egg-rr68.5%
associate-*l/68.5%
associate-*r*80.0%
*-commutative80.0%
associate-*l/80.0%
associate-*r/80.0%
Simplified80.0%
clear-num80.1%
inv-pow80.1%
Applied egg-rr80.1%
unpow-180.1%
Simplified80.1%
Final simplification91.8%
(FPCore (t l k) :precision binary64 (if (<= (* l l) 1e+258) (* (/ 2.0 k) (/ (/ l (* (sin k) (/ (tan k) l))) (* k t))) (* (/ l (tan k)) (* 2.0 (/ l (* (sin k) (* k (* k t))))))))
double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e+258) {
tmp = (2.0 / k) * ((l / (sin(k) * (tan(k) / l))) / (k * t));
} else {
tmp = (l / tan(k)) * (2.0 * (l / (sin(k) * (k * (k * t)))));
}
return tmp;
}
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 ((l * l) <= 1d+258) then
tmp = (2.0d0 / k) * ((l / (sin(k) * (tan(k) / l))) / (k * t))
else
tmp = (l / tan(k)) * (2.0d0 * (l / (sin(k) * (k * (k * t)))))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e+258) {
tmp = (2.0 / k) * ((l / (Math.sin(k) * (Math.tan(k) / l))) / (k * t));
} else {
tmp = (l / Math.tan(k)) * (2.0 * (l / (Math.sin(k) * (k * (k * t)))));
}
return tmp;
}
def code(t, l, k): tmp = 0 if (l * l) <= 1e+258: tmp = (2.0 / k) * ((l / (math.sin(k) * (math.tan(k) / l))) / (k * t)) else: tmp = (l / math.tan(k)) * (2.0 * (l / (math.sin(k) * (k * (k * t))))) return tmp
function code(t, l, k) tmp = 0.0 if (Float64(l * l) <= 1e+258) tmp = Float64(Float64(2.0 / k) * Float64(Float64(l / Float64(sin(k) * Float64(tan(k) / l))) / Float64(k * t))); else tmp = Float64(Float64(l / tan(k)) * Float64(2.0 * Float64(l / Float64(sin(k) * Float64(k * Float64(k * t)))))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if ((l * l) <= 1e+258) tmp = (2.0 / k) * ((l / (sin(k) * (tan(k) / l))) / (k * t)); else tmp = (l / tan(k)) * (2.0 * (l / (sin(k) * (k * (k * t))))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[N[(l * l), $MachinePrecision], 1e+258], N[(N[(2.0 / k), $MachinePrecision] * N[(N[(l / N[(N[Sin[k], $MachinePrecision] * N[(N[Tan[k], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(l / N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(l / N[(N[Sin[k], $MachinePrecision] * N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq 10^{+258}:\\
\;\;\;\;\frac{2}{k} \cdot \frac{\frac{\ell}{\sin k \cdot \frac{\tan k}{\ell}}}{k \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{\tan k} \cdot \left(2 \cdot \frac{\ell}{\sin k \cdot \left(k \cdot \left(k \cdot t\right)\right)}\right)\\
\end{array}
\end{array}
if (*.f64 l l) < 1.00000000000000006e258Initial program 36.0%
associate-*l*36.0%
associate-*l*36.0%
associate-/r*35.5%
associate-/r/35.5%
*-commutative35.5%
times-frac37.5%
+-commutative37.5%
associate--l+48.7%
metadata-eval48.7%
+-rgt-identity48.7%
times-frac55.6%
Simplified55.6%
Taylor expanded in t around 0 89.9%
unpow289.9%
Simplified89.9%
*-commutative89.9%
clear-num89.9%
frac-times90.0%
*-un-lft-identity90.0%
Applied egg-rr90.0%
associate-*r*91.9%
associate-*l/92.0%
clear-num91.6%
associate-*l/91.6%
associate-*r/91.6%
associate-*r/91.6%
associate-*l/91.6%
clear-num92.0%
*-commutative92.0%
Applied egg-rr92.0%
times-frac96.0%
Applied egg-rr96.0%
if 1.00000000000000006e258 < (*.f64 l l) Initial program 32.6%
associate-*l*32.6%
associate-*l*32.6%
associate-/r*32.6%
associate-/r/32.6%
*-commutative32.6%
times-frac32.5%
+-commutative32.5%
associate--l+32.5%
metadata-eval32.5%
+-rgt-identity32.5%
times-frac32.5%
Simplified32.5%
Taylor expanded in t around 0 59.5%
unpow259.5%
Simplified59.5%
associate-*l/59.5%
associate-*l*68.5%
Applied egg-rr68.5%
associate-*l/68.5%
associate-*r*80.0%
*-commutative80.0%
associate-*l/80.0%
associate-*r/80.0%
Simplified80.0%
Taylor expanded in l around 0 68.5%
*-commutative68.5%
associate-*l*68.5%
*-commutative68.5%
unpow268.5%
associate-*r*80.0%
Simplified80.0%
Final simplification91.7%
(FPCore (t l k) :precision binary64 (if (<= (* l l) 1e+258) (* (/ 2.0 k) (/ (/ l (* (sin k) (/ (tan k) l))) (* k t))) (* (/ l (tan k)) (/ (/ (* l 2.0) (sin k)) (* k (* k t))))))
double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e+258) {
tmp = (2.0 / k) * ((l / (sin(k) * (tan(k) / l))) / (k * t));
} else {
tmp = (l / tan(k)) * (((l * 2.0) / sin(k)) / (k * (k * t)));
}
return tmp;
}
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 ((l * l) <= 1d+258) then
tmp = (2.0d0 / k) * ((l / (sin(k) * (tan(k) / l))) / (k * t))
else
tmp = (l / tan(k)) * (((l * 2.0d0) / sin(k)) / (k * (k * t)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e+258) {
tmp = (2.0 / k) * ((l / (Math.sin(k) * (Math.tan(k) / l))) / (k * t));
} else {
tmp = (l / Math.tan(k)) * (((l * 2.0) / Math.sin(k)) / (k * (k * t)));
}
return tmp;
}
def code(t, l, k): tmp = 0 if (l * l) <= 1e+258: tmp = (2.0 / k) * ((l / (math.sin(k) * (math.tan(k) / l))) / (k * t)) else: tmp = (l / math.tan(k)) * (((l * 2.0) / math.sin(k)) / (k * (k * t))) return tmp
function code(t, l, k) tmp = 0.0 if (Float64(l * l) <= 1e+258) tmp = Float64(Float64(2.0 / k) * Float64(Float64(l / Float64(sin(k) * Float64(tan(k) / l))) / Float64(k * t))); else tmp = Float64(Float64(l / tan(k)) * Float64(Float64(Float64(l * 2.0) / sin(k)) / Float64(k * Float64(k * t)))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if ((l * l) <= 1e+258) tmp = (2.0 / k) * ((l / (sin(k) * (tan(k) / l))) / (k * t)); else tmp = (l / tan(k)) * (((l * 2.0) / sin(k)) / (k * (k * t))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[N[(l * l), $MachinePrecision], 1e+258], N[(N[(2.0 / k), $MachinePrecision] * N[(N[(l / N[(N[Sin[k], $MachinePrecision] * N[(N[Tan[k], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(l / N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(l * 2.0), $MachinePrecision] / N[Sin[k], $MachinePrecision]), $MachinePrecision] / N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq 10^{+258}:\\
\;\;\;\;\frac{2}{k} \cdot \frac{\frac{\ell}{\sin k \cdot \frac{\tan k}{\ell}}}{k \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{\tan k} \cdot \frac{\frac{\ell \cdot 2}{\sin k}}{k \cdot \left(k \cdot t\right)}\\
\end{array}
\end{array}
if (*.f64 l l) < 1.00000000000000006e258Initial program 36.0%
associate-*l*36.0%
associate-*l*36.0%
associate-/r*35.5%
associate-/r/35.5%
*-commutative35.5%
times-frac37.5%
+-commutative37.5%
associate--l+48.7%
metadata-eval48.7%
+-rgt-identity48.7%
times-frac55.6%
Simplified55.6%
Taylor expanded in t around 0 89.9%
unpow289.9%
Simplified89.9%
*-commutative89.9%
clear-num89.9%
frac-times90.0%
*-un-lft-identity90.0%
Applied egg-rr90.0%
associate-*r*91.9%
associate-*l/92.0%
clear-num91.6%
associate-*l/91.6%
associate-*r/91.6%
associate-*r/91.6%
associate-*l/91.6%
clear-num92.0%
*-commutative92.0%
Applied egg-rr92.0%
times-frac96.0%
Applied egg-rr96.0%
if 1.00000000000000006e258 < (*.f64 l l) Initial program 32.6%
associate-*l*32.6%
associate-*l*32.6%
associate-/r*32.6%
associate-/r/32.6%
*-commutative32.6%
times-frac32.5%
+-commutative32.5%
associate--l+32.5%
metadata-eval32.5%
+-rgt-identity32.5%
times-frac32.5%
Simplified32.5%
Taylor expanded in t around 0 59.5%
unpow259.5%
Simplified59.5%
associate-*l/59.5%
associate-*l*68.5%
Applied egg-rr68.5%
associate-*l/68.5%
associate-*r*80.0%
*-commutative80.0%
associate-*l/80.0%
associate-*r/80.0%
Simplified80.0%
Final simplification91.8%
(FPCore (t l k) :precision binary64 (if (<= (* l l) 1e+192) (* (/ 2.0 k) (/ (/ l (* (sin k) (/ (tan k) l))) (* k t))) (/ (/ l (tan k)) (* (sin k) (/ (* k (* k t)) (* l 2.0))))))
double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e+192) {
tmp = (2.0 / k) * ((l / (sin(k) * (tan(k) / l))) / (k * t));
} else {
tmp = (l / tan(k)) / (sin(k) * ((k * (k * t)) / (l * 2.0)));
}
return tmp;
}
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 ((l * l) <= 1d+192) then
tmp = (2.0d0 / k) * ((l / (sin(k) * (tan(k) / l))) / (k * t))
else
tmp = (l / tan(k)) / (sin(k) * ((k * (k * t)) / (l * 2.0d0)))
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if ((l * l) <= 1e+192) {
tmp = (2.0 / k) * ((l / (Math.sin(k) * (Math.tan(k) / l))) / (k * t));
} else {
tmp = (l / Math.tan(k)) / (Math.sin(k) * ((k * (k * t)) / (l * 2.0)));
}
return tmp;
}
def code(t, l, k): tmp = 0 if (l * l) <= 1e+192: tmp = (2.0 / k) * ((l / (math.sin(k) * (math.tan(k) / l))) / (k * t)) else: tmp = (l / math.tan(k)) / (math.sin(k) * ((k * (k * t)) / (l * 2.0))) return tmp
function code(t, l, k) tmp = 0.0 if (Float64(l * l) <= 1e+192) tmp = Float64(Float64(2.0 / k) * Float64(Float64(l / Float64(sin(k) * Float64(tan(k) / l))) / Float64(k * t))); else tmp = Float64(Float64(l / tan(k)) / Float64(sin(k) * Float64(Float64(k * Float64(k * t)) / Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if ((l * l) <= 1e+192) tmp = (2.0 / k) * ((l / (sin(k) * (tan(k) / l))) / (k * t)); else tmp = (l / tan(k)) / (sin(k) * ((k * (k * t)) / (l * 2.0))); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[N[(l * l), $MachinePrecision], 1e+192], N[(N[(2.0 / k), $MachinePrecision] * N[(N[(l / N[(N[Sin[k], $MachinePrecision] * N[(N[Tan[k], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(l / N[Tan[k], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[k], $MachinePrecision] * N[(N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision] / N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \cdot \ell \leq 10^{+192}:\\
\;\;\;\;\frac{2}{k} \cdot \frac{\frac{\ell}{\sin k \cdot \frac{\tan k}{\ell}}}{k \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\ell}{\tan k}}{\sin k \cdot \frac{k \cdot \left(k \cdot t\right)}{\ell \cdot 2}}\\
\end{array}
\end{array}
if (*.f64 l l) < 1.00000000000000004e192Initial program 35.2%
associate-*l*35.2%
associate-*l*35.2%
associate-/r*34.6%
associate-/r/34.6%
*-commutative34.6%
times-frac36.2%
+-commutative36.2%
associate--l+48.0%
metadata-eval48.0%
+-rgt-identity48.0%
times-frac55.3%
Simplified55.3%
Taylor expanded in t around 0 89.9%
unpow289.9%
Simplified89.9%
*-commutative89.9%
clear-num89.9%
frac-times89.9%
*-un-lft-identity89.9%
Applied egg-rr89.9%
associate-*r*92.0%
associate-*l/92.0%
clear-num91.6%
associate-*l/91.6%
associate-*r/91.6%
associate-*r/91.6%
associate-*l/91.6%
clear-num92.0%
*-commutative92.0%
Applied egg-rr92.0%
times-frac96.3%
Applied egg-rr96.3%
if 1.00000000000000004e192 < (*.f64 l l) Initial program 34.9%
associate-*l*34.9%
associate-*l*35.0%
associate-/r*34.9%
associate-/r/34.9%
*-commutative34.9%
times-frac36.1%
+-commutative36.1%
associate--l+36.1%
metadata-eval36.1%
+-rgt-identity36.1%
times-frac36.1%
Simplified36.1%
Taylor expanded in t around 0 63.4%
unpow263.4%
Simplified63.4%
associate-*l/63.5%
associate-*l*71.3%
Applied egg-rr71.3%
associate-*l/71.3%
associate-*r*81.3%
*-commutative81.3%
associate-*l/81.3%
associate-*r/81.3%
Simplified81.3%
expm1-log1p-u35.0%
expm1-udef33.6%
*-commutative33.6%
Applied egg-rr33.6%
expm1-def35.0%
expm1-log1p81.3%
*-commutative81.3%
associate-*r/71.3%
associate-/l*81.4%
associate-/r/81.3%
Simplified81.3%
Final simplification91.8%
(FPCore (t l k) :precision binary64 (* (/ 2.0 k) (/ (/ l (* (sin k) (/ (tan k) l))) (* k t))))
double code(double t, double l, double k) {
return (2.0 / k) * ((l / (sin(k) * (tan(k) / l))) / (k * t));
}
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 / k) * ((l / (sin(k) * (tan(k) / l))) / (k * t))
end function
public static double code(double t, double l, double k) {
return (2.0 / k) * ((l / (Math.sin(k) * (Math.tan(k) / l))) / (k * t));
}
def code(t, l, k): return (2.0 / k) * ((l / (math.sin(k) * (math.tan(k) / l))) / (k * t))
function code(t, l, k) return Float64(Float64(2.0 / k) * Float64(Float64(l / Float64(sin(k) * Float64(tan(k) / l))) / Float64(k * t))) end
function tmp = code(t, l, k) tmp = (2.0 / k) * ((l / (sin(k) * (tan(k) / l))) / (k * t)); end
code[t_, l_, k_] := N[(N[(2.0 / k), $MachinePrecision] * N[(N[(l / N[(N[Sin[k], $MachinePrecision] * N[(N[Tan[k], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{k} \cdot \frac{\frac{\ell}{\sin k \cdot \frac{\tan k}{\ell}}}{k \cdot t}
\end{array}
Initial program 35.1%
associate-*l*35.1%
associate-*l*35.1%
associate-/r*34.7%
associate-/r/34.7%
*-commutative34.7%
times-frac36.2%
+-commutative36.2%
associate--l+44.4%
metadata-eval44.4%
+-rgt-identity44.4%
times-frac49.5%
Simplified49.5%
Taylor expanded in t around 0 81.8%
unpow281.8%
Simplified81.8%
*-commutative81.8%
clear-num81.8%
frac-times81.9%
*-un-lft-identity81.9%
Applied egg-rr81.9%
associate-*r*85.7%
associate-*l/85.7%
clear-num85.5%
associate-*l/85.5%
associate-*r/85.5%
associate-*r/85.5%
associate-*l/85.5%
clear-num85.7%
*-commutative85.7%
Applied egg-rr85.7%
times-frac88.4%
Applied egg-rr88.4%
Final simplification88.4%
(FPCore (t l k) :precision binary64 (/ 2.0 (* (* k (/ k (cos k))) (/ t (pow (/ l k) 2.0)))))
double code(double t, double l, double k) {
return 2.0 / ((k * (k / cos(k))) * (t / pow((l / k), 2.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 / ((k * (k / cos(k))) * (t / ((l / k) ** 2.0d0)))
end function
public static double code(double t, double l, double k) {
return 2.0 / ((k * (k / Math.cos(k))) * (t / Math.pow((l / k), 2.0)));
}
def code(t, l, k): return 2.0 / ((k * (k / math.cos(k))) * (t / math.pow((l / k), 2.0)))
function code(t, l, k) return Float64(2.0 / Float64(Float64(k * Float64(k / cos(k))) * Float64(t / (Float64(l / k) ^ 2.0)))) end
function tmp = code(t, l, k) tmp = 2.0 / ((k * (k / cos(k))) * (t / ((l / k) ^ 2.0))); end
code[t_, l_, k_] := N[(2.0 / N[(N[(k * N[(k / N[Cos[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t / N[Power[N[(l / k), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{\left(k \cdot \frac{k}{\cos k}\right) \cdot \frac{t}{{\left(\frac{\ell}{k}\right)}^{2}}}
\end{array}
Initial program 35.1%
+-rgt-identity25.2%
associate-*l*25.2%
mul0-rgt18.6%
distribute-lft-in32.7%
+-rgt-identity35.1%
sub-neg35.1%
+-commutative35.1%
associate-+l+42.2%
metadata-eval42.2%
metadata-eval42.2%
+-rgt-identity42.2%
Simplified42.2%
unpow342.2%
*-un-lft-identity42.2%
times-frac46.7%
Applied egg-rr46.7%
Taylor expanded in t around 0 74.2%
*-commutative74.2%
times-frac75.6%
unpow275.6%
associate-/l*75.7%
associate-/r/75.6%
associate-/l*75.7%
associate-/r/73.4%
unpow273.4%
Simplified73.4%
Taylor expanded in k around 0 66.2%
*-commutative66.2%
associate-/l*66.3%
unpow266.3%
unpow266.3%
times-frac74.2%
unpow274.2%
Simplified74.2%
Final simplification74.2%
(FPCore (t l k) :precision binary64 (* (/ 2.0 (* k (* k t))) (* (/ l k) (/ l k))))
double code(double t, double l, double k) {
return (2.0 / (k * (k * t))) * ((l / k) * (l / k));
}
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 / (k * (k * t))) * ((l / k) * (l / k))
end function
public static double code(double t, double l, double k) {
return (2.0 / (k * (k * t))) * ((l / k) * (l / k));
}
def code(t, l, k): return (2.0 / (k * (k * t))) * ((l / k) * (l / k))
function code(t, l, k) return Float64(Float64(2.0 / Float64(k * Float64(k * t))) * Float64(Float64(l / k) * Float64(l / k))) end
function tmp = code(t, l, k) tmp = (2.0 / (k * (k * t))) * ((l / k) * (l / k)); end
code[t_, l_, k_] := N[(N[(2.0 / N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l / k), $MachinePrecision] * N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{k \cdot \left(k \cdot t\right)} \cdot \left(\frac{\ell}{k} \cdot \frac{\ell}{k}\right)
\end{array}
Initial program 35.1%
associate-*l*35.1%
associate-*l*35.1%
associate-/r*34.7%
associate-/r/34.7%
*-commutative34.7%
times-frac36.2%
+-commutative36.2%
associate--l+44.4%
metadata-eval44.4%
+-rgt-identity44.4%
times-frac49.5%
Simplified49.5%
Taylor expanded in t around 0 81.8%
unpow281.8%
Simplified81.8%
Taylor expanded in k around 0 64.9%
unpow264.9%
unpow264.9%
Simplified64.9%
times-frac72.1%
Applied egg-rr72.1%
Taylor expanded in k around 0 72.1%
unpow272.1%
associate-*r*72.1%
Simplified72.1%
Final simplification72.1%
(FPCore (t l k) :precision binary64 (/ (* 2.0 (/ l (* k (/ k l)))) (* k (* k t))))
double code(double t, double l, double k) {
return (2.0 * (l / (k * (k / l)))) / (k * (k * t));
}
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 / l)))) / (k * (k * t))
end function
public static double code(double t, double l, double k) {
return (2.0 * (l / (k * (k / l)))) / (k * (k * t));
}
def code(t, l, k): return (2.0 * (l / (k * (k / l)))) / (k * (k * t))
function code(t, l, k) return Float64(Float64(2.0 * Float64(l / Float64(k * Float64(k / l)))) / Float64(k * Float64(k * t))) end
function tmp = code(t, l, k) tmp = (2.0 * (l / (k * (k / l)))) / (k * (k * t)); end
code[t_, l_, k_] := N[(N[(2.0 * N[(l / N[(k * N[(k / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2 \cdot \frac{\ell}{k \cdot \frac{k}{\ell}}}{k \cdot \left(k \cdot t\right)}
\end{array}
Initial program 35.1%
associate-*l*35.1%
associate-*l*35.1%
associate-/r*34.7%
associate-/r/34.7%
*-commutative34.7%
times-frac36.2%
+-commutative36.2%
associate--l+44.4%
metadata-eval44.4%
+-rgt-identity44.4%
times-frac49.5%
Simplified49.5%
Taylor expanded in t around 0 81.8%
unpow281.8%
Simplified81.8%
*-commutative81.8%
clear-num81.8%
frac-times81.9%
*-un-lft-identity81.9%
Applied egg-rr81.9%
associate-*r*85.7%
associate-*l/85.7%
clear-num85.5%
associate-*l/85.5%
associate-*r/85.5%
associate-*r/85.5%
associate-*l/85.5%
clear-num85.7%
*-commutative85.7%
Applied egg-rr85.7%
Taylor expanded in k around 0 72.1%
unpow272.1%
associate-/l*72.1%
associate-/r/72.1%
Simplified72.1%
Final simplification72.1%
herbie shell --seed 2023242
(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))))