
(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 12 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 (* (/ (/ (* 2.0 l) (sin k)) k) (* (/ l (tan k)) (/ 1.0 (* k t)))))
double code(double t, double l, double k) {
return (((2.0 * l) / sin(k)) / k) * ((l / tan(k)) * (1.0 / (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) / sin(k)) / k) * ((l / tan(k)) * (1.0d0 / (k * t)))
end function
public static double code(double t, double l, double k) {
return (((2.0 * l) / Math.sin(k)) / k) * ((l / Math.tan(k)) * (1.0 / (k * t)));
}
def code(t, l, k): return (((2.0 * l) / math.sin(k)) / k) * ((l / math.tan(k)) * (1.0 / (k * t)))
function code(t, l, k) return Float64(Float64(Float64(Float64(2.0 * l) / sin(k)) / k) * Float64(Float64(l / tan(k)) * Float64(1.0 / Float64(k * t)))) end
function tmp = code(t, l, k) tmp = (((2.0 * l) / sin(k)) / k) * ((l / tan(k)) * (1.0 / (k * t))); end
code[t_, l_, k_] := N[(N[(N[(N[(2.0 * l), $MachinePrecision] / N[Sin[k], $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision] * N[(N[(l / N[Tan[k], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{2 \cdot \ell}{\sin k}}{k} \cdot \left(\frac{\ell}{\tan k} \cdot \frac{1}{k \cdot t}\right)
\end{array}
Initial program 35.1%
associate-*l*35.1%
associate-*l*35.5%
associate-/r*35.5%
associate-/r/35.5%
*-commutative35.5%
times-frac35.2%
+-commutative35.2%
associate--l+46.1%
metadata-eval46.1%
+-rgt-identity46.1%
times-frac48.4%
Simplified48.4%
Taylor expanded in t around 0 81.0%
unpow281.0%
associate-*l*84.2%
Simplified84.2%
associate-*l/84.3%
Applied egg-rr84.3%
associate-*r*84.3%
times-frac98.3%
associate-*r/98.3%
Simplified98.3%
div-inv98.3%
Applied egg-rr98.3%
Final simplification98.3%
(FPCore (t l k) :precision binary64 (* (/ (/ l (tan k)) (* k t)) (* 2.0 (/ l (* k (sin k))))))
double code(double t, double l, double k) {
return ((l / tan(k)) / (k * t)) * (2.0 * (l / (k * sin(k))));
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = ((l / tan(k)) / (k * t)) * (2.0d0 * (l / (k * sin(k))))
end function
public static double code(double t, double l, double k) {
return ((l / Math.tan(k)) / (k * t)) * (2.0 * (l / (k * Math.sin(k))));
}
def code(t, l, k): return ((l / math.tan(k)) / (k * t)) * (2.0 * (l / (k * math.sin(k))))
function code(t, l, k) return Float64(Float64(Float64(l / tan(k)) / Float64(k * t)) * Float64(2.0 * Float64(l / Float64(k * sin(k))))) end
function tmp = code(t, l, k) tmp = ((l / tan(k)) / (k * t)) * (2.0 * (l / (k * sin(k)))); end
code[t_, l_, k_] := N[(N[(N[(l / N[Tan[k], $MachinePrecision]), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(l / N[(k * N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\ell}{\tan k}}{k \cdot t} \cdot \left(2 \cdot \frac{\ell}{k \cdot \sin k}\right)
\end{array}
Initial program 35.1%
associate-*l*35.1%
associate-*l*35.5%
associate-/r*35.5%
associate-/r/35.5%
*-commutative35.5%
times-frac35.2%
+-commutative35.2%
associate--l+46.1%
metadata-eval46.1%
+-rgt-identity46.1%
times-frac48.4%
Simplified48.4%
Taylor expanded in t around 0 81.0%
unpow281.0%
associate-*l*84.2%
Simplified84.2%
associate-*l/84.3%
Applied egg-rr84.3%
associate-*r*84.3%
times-frac98.3%
associate-*r/98.3%
Simplified98.3%
Taylor expanded in l around 0 97.8%
Final simplification97.8%
(FPCore (t l k) :precision binary64 (* (/ (/ l (tan k)) (* k t)) (* 2.0 (/ (/ l k) (sin k)))))
double code(double t, double l, double k) {
return ((l / tan(k)) / (k * t)) * (2.0 * ((l / k) / sin(k)));
}
real(8) function code(t, l, k)
real(8), intent (in) :: t
real(8), intent (in) :: l
real(8), intent (in) :: k
code = ((l / tan(k)) / (k * t)) * (2.0d0 * ((l / k) / sin(k)))
end function
public static double code(double t, double l, double k) {
return ((l / Math.tan(k)) / (k * t)) * (2.0 * ((l / k) / Math.sin(k)));
}
def code(t, l, k): return ((l / math.tan(k)) / (k * t)) * (2.0 * ((l / k) / math.sin(k)))
function code(t, l, k) return Float64(Float64(Float64(l / tan(k)) / Float64(k * t)) * Float64(2.0 * Float64(Float64(l / k) / sin(k)))) end
function tmp = code(t, l, k) tmp = ((l / tan(k)) / (k * t)) * (2.0 * ((l / k) / sin(k))); end
code[t_, l_, k_] := N[(N[(N[(l / N[Tan[k], $MachinePrecision]), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(N[(l / k), $MachinePrecision] / N[Sin[k], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\ell}{\tan k}}{k \cdot t} \cdot \left(2 \cdot \frac{\frac{\ell}{k}}{\sin k}\right)
\end{array}
Initial program 35.1%
associate-*l*35.1%
associate-*l*35.5%
associate-/r*35.5%
associate-/r/35.5%
*-commutative35.5%
times-frac35.2%
+-commutative35.2%
associate--l+46.1%
metadata-eval46.1%
+-rgt-identity46.1%
times-frac48.4%
Simplified48.4%
Taylor expanded in t around 0 81.0%
unpow281.0%
associate-*l*84.2%
Simplified84.2%
associate-*l/84.3%
Applied egg-rr84.3%
associate-*r*84.3%
times-frac98.3%
associate-*r/98.3%
Simplified98.3%
Taylor expanded in l around 0 97.8%
associate-/r*98.3%
Simplified98.3%
Final simplification98.3%
(FPCore (t l k) :precision binary64 (* (/ (/ (* 2.0 l) (sin k)) k) (/ (/ l (tan k)) (* k t))))
double code(double t, double l, double k) {
return (((2.0 * l) / sin(k)) / k) * ((l / tan(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) / sin(k)) / k) * ((l / tan(k)) / (k * t))
end function
public static double code(double t, double l, double k) {
return (((2.0 * l) / Math.sin(k)) / k) * ((l / Math.tan(k)) / (k * t));
}
def code(t, l, k): return (((2.0 * l) / math.sin(k)) / k) * ((l / math.tan(k)) / (k * t))
function code(t, l, k) return Float64(Float64(Float64(Float64(2.0 * l) / sin(k)) / k) * Float64(Float64(l / tan(k)) / Float64(k * t))) end
function tmp = code(t, l, k) tmp = (((2.0 * l) / sin(k)) / k) * ((l / tan(k)) / (k * t)); end
code[t_, l_, k_] := N[(N[(N[(N[(2.0 * l), $MachinePrecision] / N[Sin[k], $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision] * N[(N[(l / N[Tan[k], $MachinePrecision]), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{2 \cdot \ell}{\sin k}}{k} \cdot \frac{\frac{\ell}{\tan k}}{k \cdot t}
\end{array}
Initial program 35.1%
associate-*l*35.1%
associate-*l*35.5%
associate-/r*35.5%
associate-/r/35.5%
*-commutative35.5%
times-frac35.2%
+-commutative35.2%
associate--l+46.1%
metadata-eval46.1%
+-rgt-identity46.1%
times-frac48.4%
Simplified48.4%
Taylor expanded in t around 0 81.0%
unpow281.0%
associate-*l*84.2%
Simplified84.2%
associate-*l/84.3%
Applied egg-rr84.3%
associate-*r*84.3%
times-frac98.3%
associate-*r/98.3%
Simplified98.3%
Final simplification98.3%
(FPCore (t l k)
:precision binary64
(if (<= k 3.15)
(*
(/ (/ l (tan k)) (* k t))
(/ (+ (* (* l k) 0.3333333333333333) (* 2.0 (/ l k))) k))
(* (/ 2.0 (* k (* k t))) (/ (* l (/ l k)) k))))
double code(double t, double l, double k) {
double tmp;
if (k <= 3.15) {
tmp = ((l / tan(k)) / (k * t)) * ((((l * k) * 0.3333333333333333) + (2.0 * (l / k))) / k);
} else {
tmp = (2.0 / (k * (k * t))) * ((l * (l / k)) / k);
}
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 (k <= 3.15d0) then
tmp = ((l / tan(k)) / (k * t)) * ((((l * k) * 0.3333333333333333d0) + (2.0d0 * (l / k))) / k)
else
tmp = (2.0d0 / (k * (k * t))) * ((l * (l / k)) / k)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (k <= 3.15) {
tmp = ((l / Math.tan(k)) / (k * t)) * ((((l * k) * 0.3333333333333333) + (2.0 * (l / k))) / k);
} else {
tmp = (2.0 / (k * (k * t))) * ((l * (l / k)) / k);
}
return tmp;
}
def code(t, l, k): tmp = 0 if k <= 3.15: tmp = ((l / math.tan(k)) / (k * t)) * ((((l * k) * 0.3333333333333333) + (2.0 * (l / k))) / k) else: tmp = (2.0 / (k * (k * t))) * ((l * (l / k)) / k) return tmp
function code(t, l, k) tmp = 0.0 if (k <= 3.15) tmp = Float64(Float64(Float64(l / tan(k)) / Float64(k * t)) * Float64(Float64(Float64(Float64(l * k) * 0.3333333333333333) + Float64(2.0 * Float64(l / k))) / k)); else tmp = Float64(Float64(2.0 / Float64(k * Float64(k * t))) * Float64(Float64(l * Float64(l / k)) / k)); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 3.15) tmp = ((l / tan(k)) / (k * t)) * ((((l * k) * 0.3333333333333333) + (2.0 * (l / k))) / k); else tmp = (2.0 / (k * (k * t))) * ((l * (l / k)) / k); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[k, 3.15], N[(N[(N[(l / N[Tan[k], $MachinePrecision]), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(l * k), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] + N[(2.0 * N[(l / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l * N[(l / k), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3.15:\\
\;\;\;\;\frac{\frac{\ell}{\tan k}}{k \cdot t} \cdot \frac{\left(\ell \cdot k\right) \cdot 0.3333333333333333 + 2 \cdot \frac{\ell}{k}}{k}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{k \cdot \left(k \cdot t\right)} \cdot \frac{\ell \cdot \frac{\ell}{k}}{k}\\
\end{array}
\end{array}
if k < 3.14999999999999991Initial program 37.9%
associate-*l*37.9%
associate-*l*38.4%
associate-/r*38.4%
associate-/r/38.4%
*-commutative38.4%
times-frac37.9%
+-commutative37.9%
associate--l+46.6%
metadata-eval46.6%
+-rgt-identity46.6%
times-frac49.9%
Simplified49.9%
Taylor expanded in t around 0 82.8%
unpow282.8%
associate-*l*85.8%
Simplified85.8%
associate-*l/85.9%
Applied egg-rr85.9%
associate-*r*85.9%
times-frac98.6%
associate-*r/98.6%
Simplified98.6%
Taylor expanded in k around 0 71.5%
if 3.14999999999999991 < k Initial program 28.8%
associate-*l*28.8%
associate-*l*28.8%
associate-/r*28.8%
associate-/r/28.8%
*-commutative28.8%
times-frac28.9%
+-commutative28.9%
associate--l+44.9%
metadata-eval44.9%
+-rgt-identity44.9%
times-frac44.9%
Simplified44.9%
Taylor expanded in t around 0 76.9%
unpow276.9%
associate-*l*80.6%
Simplified80.6%
Taylor expanded in k around 0 61.1%
unpow261.1%
unpow261.1%
times-frac61.7%
Simplified61.7%
associate-*r/61.7%
Applied egg-rr61.7%
Final simplification68.6%
(FPCore (t l k)
:precision binary64
(if (<= k 200000000000.0)
(*
(/ (/ (* 2.0 l) (sin k)) k)
(/ (+ (/ l k) (* -0.3333333333333333 (* l k))) (* k t)))
(* (/ 2.0 (* k (* k t))) (/ (* l (/ l k)) k))))
double code(double t, double l, double k) {
double tmp;
if (k <= 200000000000.0) {
tmp = (((2.0 * l) / sin(k)) / k) * (((l / k) + (-0.3333333333333333 * (l * k))) / (k * t));
} else {
tmp = (2.0 / (k * (k * t))) * ((l * (l / k)) / k);
}
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 (k <= 200000000000.0d0) then
tmp = (((2.0d0 * l) / sin(k)) / k) * (((l / k) + ((-0.3333333333333333d0) * (l * k))) / (k * t))
else
tmp = (2.0d0 / (k * (k * t))) * ((l * (l / k)) / k)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (k <= 200000000000.0) {
tmp = (((2.0 * l) / Math.sin(k)) / k) * (((l / k) + (-0.3333333333333333 * (l * k))) / (k * t));
} else {
tmp = (2.0 / (k * (k * t))) * ((l * (l / k)) / k);
}
return tmp;
}
def code(t, l, k): tmp = 0 if k <= 200000000000.0: tmp = (((2.0 * l) / math.sin(k)) / k) * (((l / k) + (-0.3333333333333333 * (l * k))) / (k * t)) else: tmp = (2.0 / (k * (k * t))) * ((l * (l / k)) / k) return tmp
function code(t, l, k) tmp = 0.0 if (k <= 200000000000.0) tmp = Float64(Float64(Float64(Float64(2.0 * l) / sin(k)) / k) * Float64(Float64(Float64(l / k) + Float64(-0.3333333333333333 * Float64(l * k))) / Float64(k * t))); else tmp = Float64(Float64(2.0 / Float64(k * Float64(k * t))) * Float64(Float64(l * Float64(l / k)) / k)); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (k <= 200000000000.0) tmp = (((2.0 * l) / sin(k)) / k) * (((l / k) + (-0.3333333333333333 * (l * k))) / (k * t)); else tmp = (2.0 / (k * (k * t))) * ((l * (l / k)) / k); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[k, 200000000000.0], N[(N[(N[(N[(2.0 * l), $MachinePrecision] / N[Sin[k], $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision] * N[(N[(N[(l / k), $MachinePrecision] + N[(-0.3333333333333333 * N[(l * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l * N[(l / k), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 200000000000:\\
\;\;\;\;\frac{\frac{2 \cdot \ell}{\sin k}}{k} \cdot \frac{\frac{\ell}{k} + -0.3333333333333333 \cdot \left(\ell \cdot k\right)}{k \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{k \cdot \left(k \cdot t\right)} \cdot \frac{\ell \cdot \frac{\ell}{k}}{k}\\
\end{array}
\end{array}
if k < 2e11Initial program 37.3%
associate-*l*37.2%
associate-*l*37.7%
associate-/r*37.7%
associate-/r/37.7%
*-commutative37.7%
times-frac37.3%
+-commutative37.3%
associate--l+45.8%
metadata-eval45.8%
+-rgt-identity45.8%
times-frac49.1%
Simplified49.1%
Taylor expanded in t around 0 83.1%
unpow283.1%
associate-*l*86.1%
Simplified86.1%
associate-*l/86.1%
Applied egg-rr86.1%
associate-*r*86.1%
times-frac98.6%
associate-*r/98.6%
Simplified98.6%
Taylor expanded in k around 0 73.9%
if 2e11 < k Initial program 29.9%
associate-*l*29.9%
associate-*l*29.9%
associate-/r*29.9%
associate-/r/29.9%
*-commutative29.9%
times-frac30.1%
+-commutative30.1%
associate--l+46.7%
metadata-eval46.7%
+-rgt-identity46.7%
times-frac46.7%
Simplified46.7%
Taylor expanded in t around 0 76.0%
unpow276.0%
associate-*l*79.8%
Simplified79.8%
Taylor expanded in k around 0 60.7%
unpow260.7%
unpow260.7%
times-frac61.4%
Simplified61.4%
associate-*r/61.4%
Applied egg-rr61.4%
Final simplification70.3%
(FPCore (t l k)
:precision binary64
(let* ((t_1 (* k (* k t))))
(if (<= l 1.4e+211)
(* (/ (/ (* 2.0 l) (sin k)) k) (/ l t_1))
(* (/ 2.0 t_1) (/ (* l (/ l k)) k)))))
double code(double t, double l, double k) {
double t_1 = k * (k * t);
double tmp;
if (l <= 1.4e+211) {
tmp = (((2.0 * l) / sin(k)) / k) * (l / t_1);
} else {
tmp = (2.0 / t_1) * ((l * (l / k)) / k);
}
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) :: t_1
real(8) :: tmp
t_1 = k * (k * t)
if (l <= 1.4d+211) then
tmp = (((2.0d0 * l) / sin(k)) / k) * (l / t_1)
else
tmp = (2.0d0 / t_1) * ((l * (l / k)) / k)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double t_1 = k * (k * t);
double tmp;
if (l <= 1.4e+211) {
tmp = (((2.0 * l) / Math.sin(k)) / k) * (l / t_1);
} else {
tmp = (2.0 / t_1) * ((l * (l / k)) / k);
}
return tmp;
}
def code(t, l, k): t_1 = k * (k * t) tmp = 0 if l <= 1.4e+211: tmp = (((2.0 * l) / math.sin(k)) / k) * (l / t_1) else: tmp = (2.0 / t_1) * ((l * (l / k)) / k) return tmp
function code(t, l, k) t_1 = Float64(k * Float64(k * t)) tmp = 0.0 if (l <= 1.4e+211) tmp = Float64(Float64(Float64(Float64(2.0 * l) / sin(k)) / k) * Float64(l / t_1)); else tmp = Float64(Float64(2.0 / t_1) * Float64(Float64(l * Float64(l / k)) / k)); end return tmp end
function tmp_2 = code(t, l, k) t_1 = k * (k * t); tmp = 0.0; if (l <= 1.4e+211) tmp = (((2.0 * l) / sin(k)) / k) * (l / t_1); else tmp = (2.0 / t_1) * ((l * (l / k)) / k); end tmp_2 = tmp; end
code[t_, l_, k_] := Block[{t$95$1 = N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 1.4e+211], N[(N[(N[(N[(2.0 * l), $MachinePrecision] / N[Sin[k], $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision] * N[(l / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / t$95$1), $MachinePrecision] * N[(N[(l * N[(l / k), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := k \cdot \left(k \cdot t\right)\\
\mathbf{if}\;\ell \leq 1.4 \cdot 10^{+211}:\\
\;\;\;\;\frac{\frac{2 \cdot \ell}{\sin k}}{k} \cdot \frac{\ell}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t_1} \cdot \frac{\ell \cdot \frac{\ell}{k}}{k}\\
\end{array}
\end{array}
if l < 1.4e211Initial program 36.5%
associate-*l*36.5%
associate-*l*36.9%
associate-/r*36.9%
associate-/r/36.9%
*-commutative36.9%
times-frac36.5%
+-commutative36.5%
associate--l+48.2%
metadata-eval48.2%
+-rgt-identity48.2%
times-frac50.8%
Simplified50.8%
Taylor expanded in t around 0 83.3%
unpow283.3%
associate-*l*86.8%
Simplified86.8%
associate-*l/86.8%
Applied egg-rr86.8%
associate-*r*86.8%
times-frac99.0%
associate-*r/99.0%
Simplified99.0%
Taylor expanded in k around 0 71.2%
unpow271.2%
associate-*r*71.7%
Simplified71.7%
if 1.4e211 < l Initial program 17.4%
associate-*l*17.4%
associate-*l*17.4%
associate-/r*17.4%
associate-/r/17.4%
*-commutative17.4%
times-frac17.4%
+-commutative17.4%
associate--l+17.4%
metadata-eval17.4%
+-rgt-identity17.4%
times-frac17.4%
Simplified17.4%
Taylor expanded in t around 0 51.1%
unpow251.1%
associate-*l*51.1%
Simplified51.1%
Taylor expanded in k around 0 50.4%
unpow250.4%
unpow250.4%
times-frac51.3%
Simplified51.3%
associate-*r/51.0%
Applied egg-rr51.0%
Final simplification70.3%
(FPCore (t l k) :precision binary64 (if (<= l 3.2e+209) (* (/ (/ (* 2.0 l) (sin k)) k) (/ (/ l k) (* k t))) (* (/ 2.0 (* k (* k t))) (/ (* l (/ l k)) k))))
double code(double t, double l, double k) {
double tmp;
if (l <= 3.2e+209) {
tmp = (((2.0 * l) / sin(k)) / k) * ((l / k) / (k * t));
} else {
tmp = (2.0 / (k * (k * t))) * ((l * (l / k)) / k);
}
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 <= 3.2d+209) then
tmp = (((2.0d0 * l) / sin(k)) / k) * ((l / k) / (k * t))
else
tmp = (2.0d0 / (k * (k * t))) * ((l * (l / k)) / k)
end if
code = tmp
end function
public static double code(double t, double l, double k) {
double tmp;
if (l <= 3.2e+209) {
tmp = (((2.0 * l) / Math.sin(k)) / k) * ((l / k) / (k * t));
} else {
tmp = (2.0 / (k * (k * t))) * ((l * (l / k)) / k);
}
return tmp;
}
def code(t, l, k): tmp = 0 if l <= 3.2e+209: tmp = (((2.0 * l) / math.sin(k)) / k) * ((l / k) / (k * t)) else: tmp = (2.0 / (k * (k * t))) * ((l * (l / k)) / k) return tmp
function code(t, l, k) tmp = 0.0 if (l <= 3.2e+209) tmp = Float64(Float64(Float64(Float64(2.0 * l) / sin(k)) / k) * Float64(Float64(l / k) / Float64(k * t))); else tmp = Float64(Float64(2.0 / Float64(k * Float64(k * t))) * Float64(Float64(l * Float64(l / k)) / k)); end return tmp end
function tmp_2 = code(t, l, k) tmp = 0.0; if (l <= 3.2e+209) tmp = (((2.0 * l) / sin(k)) / k) * ((l / k) / (k * t)); else tmp = (2.0 / (k * (k * t))) * ((l * (l / k)) / k); end tmp_2 = tmp; end
code[t_, l_, k_] := If[LessEqual[l, 3.2e+209], N[(N[(N[(N[(2.0 * l), $MachinePrecision] / N[Sin[k], $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision] * N[(N[(l / k), $MachinePrecision] / N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(l * N[(l / k), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.2 \cdot 10^{+209}:\\
\;\;\;\;\frac{\frac{2 \cdot \ell}{\sin k}}{k} \cdot \frac{\frac{\ell}{k}}{k \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{k \cdot \left(k \cdot t\right)} \cdot \frac{\ell \cdot \frac{\ell}{k}}{k}\\
\end{array}
\end{array}
if l < 3.1999999999999999e209Initial program 36.5%
associate-*l*36.5%
associate-*l*36.9%
associate-/r*36.9%
associate-/r/36.9%
*-commutative36.9%
times-frac36.5%
+-commutative36.5%
associate--l+48.2%
metadata-eval48.2%
+-rgt-identity48.2%
times-frac50.8%
Simplified50.8%
Taylor expanded in t around 0 83.3%
unpow283.3%
associate-*l*86.8%
Simplified86.8%
associate-*l/86.8%
Applied egg-rr86.8%
associate-*r*86.8%
times-frac99.0%
associate-*r/99.0%
Simplified99.0%
Taylor expanded in k around 0 72.6%
if 3.1999999999999999e209 < l Initial program 17.4%
associate-*l*17.4%
associate-*l*17.4%
associate-/r*17.4%
associate-/r/17.4%
*-commutative17.4%
times-frac17.4%
+-commutative17.4%
associate--l+17.4%
metadata-eval17.4%
+-rgt-identity17.4%
times-frac17.4%
Simplified17.4%
Taylor expanded in t around 0 51.1%
unpow251.1%
associate-*l*51.1%
Simplified51.1%
Taylor expanded in k around 0 50.4%
unpow250.4%
unpow250.4%
times-frac51.3%
Simplified51.3%
associate-*r/51.0%
Applied egg-rr51.0%
Final simplification71.0%
(FPCore (t l k) :precision binary64 (/ (* 2.0 (pow (/ l k) 2.0)) (* k (* k t))))
double code(double t, double l, double k) {
return (2.0 * pow((l / k), 2.0)) / (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) ** 2.0d0)) / (k * (k * t))
end function
public static double code(double t, double l, double k) {
return (2.0 * Math.pow((l / k), 2.0)) / (k * (k * t));
}
def code(t, l, k): return (2.0 * math.pow((l / k), 2.0)) / (k * (k * t))
function code(t, l, k) return Float64(Float64(2.0 * (Float64(l / k) ^ 2.0)) / Float64(k * Float64(k * t))) end
function tmp = code(t, l, k) tmp = (2.0 * ((l / k) ^ 2.0)) / (k * (k * t)); end
code[t_, l_, k_] := N[(N[(2.0 * N[Power[N[(l / k), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2 \cdot {\left(\frac{\ell}{k}\right)}^{2}}{k \cdot \left(k \cdot t\right)}
\end{array}
Initial program 35.1%
associate-*l*35.1%
associate-*l*35.5%
associate-/r*35.5%
associate-/r/35.5%
*-commutative35.5%
times-frac35.2%
+-commutative35.2%
associate--l+46.1%
metadata-eval46.1%
+-rgt-identity46.1%
times-frac48.4%
Simplified48.4%
Taylor expanded in t around 0 81.0%
unpow281.0%
associate-*l*84.2%
Simplified84.2%
Taylor expanded in k around 0 66.0%
unpow266.0%
unpow266.0%
times-frac69.5%
Simplified69.5%
associate-*l/69.5%
pow269.5%
Applied egg-rr69.5%
Final simplification69.5%
(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.5%
associate-/r*35.5%
associate-/r/35.5%
*-commutative35.5%
times-frac35.2%
+-commutative35.2%
associate--l+46.1%
metadata-eval46.1%
+-rgt-identity46.1%
times-frac48.4%
Simplified48.4%
Taylor expanded in t around 0 81.0%
unpow281.0%
associate-*l*84.2%
Simplified84.2%
Taylor expanded in k around 0 66.0%
unpow266.0%
unpow266.0%
times-frac69.5%
Simplified69.5%
Final simplification69.5%
(FPCore (t l k) :precision binary64 (* -0.3333333333333333 (/ (* l l) (* k (* k t)))))
double code(double t, double l, double k) {
return -0.3333333333333333 * ((l * 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 = (-0.3333333333333333d0) * ((l * l) / (k * (k * t)))
end function
public static double code(double t, double l, double k) {
return -0.3333333333333333 * ((l * l) / (k * (k * t)));
}
def code(t, l, k): return -0.3333333333333333 * ((l * l) / (k * (k * t)))
function code(t, l, k) return Float64(-0.3333333333333333 * Float64(Float64(l * l) / Float64(k * Float64(k * t)))) end
function tmp = code(t, l, k) tmp = -0.3333333333333333 * ((l * l) / (k * (k * t))); end
code[t_, l_, k_] := N[(-0.3333333333333333 * N[(N[(l * l), $MachinePrecision] / N[(k * N[(k * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.3333333333333333 \cdot \frac{\ell \cdot \ell}{k \cdot \left(k \cdot t\right)}
\end{array}
Initial program 35.1%
associate-*l*35.1%
associate-*l*35.5%
associate-/r*35.5%
associate-/r/35.5%
*-commutative35.5%
times-frac35.2%
+-commutative35.2%
associate--l+46.1%
metadata-eval46.1%
+-rgt-identity46.1%
times-frac48.4%
Simplified48.4%
Taylor expanded in t around 0 81.0%
unpow281.0%
associate-*l*84.2%
Simplified84.2%
Taylor expanded in k around 0 56.8%
*-commutative56.8%
fma-def56.8%
unpow256.8%
unpow256.8%
unpow256.8%
times-frac61.8%
Simplified61.8%
Taylor expanded in k around inf 36.4%
*-commutative36.4%
unpow236.4%
associate-*l*36.4%
Simplified36.4%
Taylor expanded in k around 0 35.8%
unpow235.8%
unpow235.8%
associate-*r*36.4%
Simplified36.4%
Final simplification36.4%
(FPCore (t l k) :precision binary64 (* (/ -0.3333333333333333 k) (/ (/ l (/ t l)) k)))
double code(double t, double l, double k) {
return (-0.3333333333333333 / k) * ((l / (t / 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 = ((-0.3333333333333333d0) / k) * ((l / (t / l)) / k)
end function
public static double code(double t, double l, double k) {
return (-0.3333333333333333 / k) * ((l / (t / l)) / k);
}
def code(t, l, k): return (-0.3333333333333333 / k) * ((l / (t / l)) / k)
function code(t, l, k) return Float64(Float64(-0.3333333333333333 / k) * Float64(Float64(l / Float64(t / l)) / k)) end
function tmp = code(t, l, k) tmp = (-0.3333333333333333 / k) * ((l / (t / l)) / k); end
code[t_, l_, k_] := N[(N[(-0.3333333333333333 / k), $MachinePrecision] * N[(N[(l / N[(t / l), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-0.3333333333333333}{k} \cdot \frac{\frac{\ell}{\frac{t}{\ell}}}{k}
\end{array}
Initial program 35.1%
associate-*l*35.1%
associate-*l*35.5%
associate-/r*35.5%
associate-/r/35.5%
*-commutative35.5%
times-frac35.2%
+-commutative35.2%
associate--l+46.1%
metadata-eval46.1%
+-rgt-identity46.1%
times-frac48.4%
Simplified48.4%
Taylor expanded in t around 0 81.0%
unpow281.0%
associate-*l*84.2%
Simplified84.2%
Taylor expanded in k around 0 56.8%
*-commutative56.8%
fma-def56.8%
unpow256.8%
unpow256.8%
unpow256.8%
times-frac61.8%
Simplified61.8%
Taylor expanded in k around inf 36.4%
*-commutative36.4%
unpow236.4%
associate-*l*36.4%
Simplified36.4%
Taylor expanded in k around 0 35.8%
unpow235.8%
associate-*r*36.4%
associate-*r/36.4%
associate-*r*35.8%
unpow235.8%
associate-/l/35.8%
associate-*r/35.8%
unpow235.8%
associate-*l/36.3%
unpow236.3%
times-frac37.0%
associate-/r/37.0%
Simplified37.0%
Final simplification37.0%
herbie shell --seed 2023207
(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))))