
(FPCore (l Om kx ky)
:precision binary64
(sqrt
(*
(/ 1.0 2.0)
(+
1.0
(/
1.0
(sqrt
(+
1.0
(*
(pow (/ (* 2.0 l) Om) 2.0)
(+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))))))
double code(double l, double Om, double kx, double ky) {
return sqrt(((1.0 / 2.0) * (1.0 + (1.0 / sqrt((1.0 + (pow(((2.0 * l) / Om), 2.0) * (pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))))))));
}
real(8) function code(l, om, kx, ky)
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: kx
real(8), intent (in) :: ky
code = sqrt(((1.0d0 / 2.0d0) * (1.0d0 + (1.0d0 / sqrt((1.0d0 + ((((2.0d0 * l) / om) ** 2.0d0) * ((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))))))))
end function
public static double code(double l, double Om, double kx, double ky) {
return Math.sqrt(((1.0 / 2.0) * (1.0 + (1.0 / Math.sqrt((1.0 + (Math.pow(((2.0 * l) / Om), 2.0) * (Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))))))));
}
def code(l, Om, kx, ky): return math.sqrt(((1.0 / 2.0) * (1.0 + (1.0 / math.sqrt((1.0 + (math.pow(((2.0 * l) / Om), 2.0) * (math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))))))))
function code(l, Om, kx, ky) return sqrt(Float64(Float64(1.0 / 2.0) * Float64(1.0 + Float64(1.0 / sqrt(Float64(1.0 + Float64((Float64(Float64(2.0 * l) / Om) ^ 2.0) * Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))))))) end
function tmp = code(l, Om, kx, ky) tmp = sqrt(((1.0 / 2.0) * (1.0 + (1.0 / sqrt((1.0 + ((((2.0 * l) / Om) ^ 2.0) * ((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))))))); end
code[l_, Om_, kx_, ky_] := N[Sqrt[N[(N[(1.0 / 2.0), $MachinePrecision] * N[(1.0 + N[(1.0 / N[Sqrt[N[(1.0 + N[(N[Power[N[(N[(2.0 * l), $MachinePrecision] / Om), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 6 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (l Om kx ky)
:precision binary64
(sqrt
(*
(/ 1.0 2.0)
(+
1.0
(/
1.0
(sqrt
(+
1.0
(*
(pow (/ (* 2.0 l) Om) 2.0)
(+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))))))
double code(double l, double Om, double kx, double ky) {
return sqrt(((1.0 / 2.0) * (1.0 + (1.0 / sqrt((1.0 + (pow(((2.0 * l) / Om), 2.0) * (pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))))))));
}
real(8) function code(l, om, kx, ky)
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: kx
real(8), intent (in) :: ky
code = sqrt(((1.0d0 / 2.0d0) * (1.0d0 + (1.0d0 / sqrt((1.0d0 + ((((2.0d0 * l) / om) ** 2.0d0) * ((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))))))))
end function
public static double code(double l, double Om, double kx, double ky) {
return Math.sqrt(((1.0 / 2.0) * (1.0 + (1.0 / Math.sqrt((1.0 + (Math.pow(((2.0 * l) / Om), 2.0) * (Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))))))));
}
def code(l, Om, kx, ky): return math.sqrt(((1.0 / 2.0) * (1.0 + (1.0 / math.sqrt((1.0 + (math.pow(((2.0 * l) / Om), 2.0) * (math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))))))))
function code(l, Om, kx, ky) return sqrt(Float64(Float64(1.0 / 2.0) * Float64(1.0 + Float64(1.0 / sqrt(Float64(1.0 + Float64((Float64(Float64(2.0 * l) / Om) ^ 2.0) * Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))))))) end
function tmp = code(l, Om, kx, ky) tmp = sqrt(((1.0 / 2.0) * (1.0 + (1.0 / sqrt((1.0 + ((((2.0 * l) / Om) ^ 2.0) * ((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))))))); end
code[l_, Om_, kx_, ky_] := N[Sqrt[N[(N[(1.0 / 2.0), $MachinePrecision] * N[(1.0 + N[(1.0 / N[Sqrt[N[(1.0 + N[(N[Power[N[(N[(2.0 * l), $MachinePrecision] / Om), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)}
\end{array}
(FPCore (l Om kx ky)
:precision binary64
(sqrt
(+
0.5
(*
0.5
(log
(exp
(/ 1.0 (hypot 1.0 (* (* 2.0 (/ l Om)) (hypot (sin kx) (sin ky)))))))))))
double code(double l, double Om, double kx, double ky) {
return sqrt((0.5 + (0.5 * log(exp((1.0 / hypot(1.0, ((2.0 * (l / Om)) * hypot(sin(kx), sin(ky))))))))));
}
public static double code(double l, double Om, double kx, double ky) {
return Math.sqrt((0.5 + (0.5 * Math.log(Math.exp((1.0 / Math.hypot(1.0, ((2.0 * (l / Om)) * Math.hypot(Math.sin(kx), Math.sin(ky))))))))));
}
def code(l, Om, kx, ky): return math.sqrt((0.5 + (0.5 * math.log(math.exp((1.0 / math.hypot(1.0, ((2.0 * (l / Om)) * math.hypot(math.sin(kx), math.sin(ky))))))))))
function code(l, Om, kx, ky) return sqrt(Float64(0.5 + Float64(0.5 * log(exp(Float64(1.0 / hypot(1.0, Float64(Float64(2.0 * Float64(l / Om)) * hypot(sin(kx), sin(ky)))))))))) end
function tmp = code(l, Om, kx, ky) tmp = sqrt((0.5 + (0.5 * log(exp((1.0 / hypot(1.0, ((2.0 * (l / Om)) * hypot(sin(kx), sin(ky)))))))))); end
code[l_, Om_, kx_, ky_] := N[Sqrt[N[(0.5 + N[(0.5 * N[Log[N[Exp[N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(2.0 * N[(l / Om), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{0.5 + 0.5 \cdot \log \left(e^{\frac{1}{\mathsf{hypot}\left(1, \left(2 \cdot \frac{\ell}{Om}\right) \cdot \mathsf{hypot}\left(\sin kx, \sin ky\right)\right)}}\right)}
\end{array}
Initial program 97.6%
distribute-rgt-in97.6%
metadata-eval97.6%
metadata-eval97.6%
associate-/l*97.6%
metadata-eval97.6%
Simplified97.6%
add-log-exp97.7%
add-sqr-sqrt97.7%
hypot-1-def97.7%
sqrt-prod97.7%
unpow297.7%
sqrt-prod57.9%
add-sqr-sqrt99.1%
div-inv99.1%
clear-num99.1%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (l Om kx ky)
:precision binary64
(sqrt
(+
0.5
(*
0.5
(/ 1.0 (hypot 1.0 (* (* 2.0 (/ l Om)) (hypot (sin ky) (sin kx)))))))))
double code(double l, double Om, double kx, double ky) {
return sqrt((0.5 + (0.5 * (1.0 / hypot(1.0, ((2.0 * (l / Om)) * hypot(sin(ky), sin(kx))))))));
}
public static double code(double l, double Om, double kx, double ky) {
return Math.sqrt((0.5 + (0.5 * (1.0 / Math.hypot(1.0, ((2.0 * (l / Om)) * Math.hypot(Math.sin(ky), Math.sin(kx))))))));
}
def code(l, Om, kx, ky): return math.sqrt((0.5 + (0.5 * (1.0 / math.hypot(1.0, ((2.0 * (l / Om)) * math.hypot(math.sin(ky), math.sin(kx))))))))
function code(l, Om, kx, ky) return sqrt(Float64(0.5 + Float64(0.5 * Float64(1.0 / hypot(1.0, Float64(Float64(2.0 * Float64(l / Om)) * hypot(sin(ky), sin(kx)))))))) end
function tmp = code(l, Om, kx, ky) tmp = sqrt((0.5 + (0.5 * (1.0 / hypot(1.0, ((2.0 * (l / Om)) * hypot(sin(ky), sin(kx)))))))); end
code[l_, Om_, kx_, ky_] := N[Sqrt[N[(0.5 + N[(0.5 * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(N[(2.0 * N[(l / Om), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \left(2 \cdot \frac{\ell}{Om}\right) \cdot \mathsf{hypot}\left(\sin ky, \sin kx\right)\right)}}
\end{array}
Initial program 97.6%
distribute-rgt-in97.6%
metadata-eval97.6%
metadata-eval97.6%
associate-/l*97.6%
metadata-eval97.6%
Simplified97.6%
expm1-log1p-u97.6%
expm1-udef97.6%
Applied egg-rr100.0%
expm1-def100.0%
expm1-log1p100.0%
*-commutative100.0%
hypot-def99.0%
unpow299.0%
unpow299.0%
+-commutative99.0%
unpow299.0%
unpow299.0%
hypot-def100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (l Om kx ky) :precision binary64 (if (<= ky 7.6e-222) (sqrt (+ 0.5 (/ 0.5 (hypot 1.0 (* (* 2.0 (/ l Om)) (sin kx)))))) (sqrt (+ 0.5 (* 0.5 (/ 1.0 (hypot 1.0 (/ 2.0 (/ (/ Om l) (sin ky))))))))))
double code(double l, double Om, double kx, double ky) {
double tmp;
if (ky <= 7.6e-222) {
tmp = sqrt((0.5 + (0.5 / hypot(1.0, ((2.0 * (l / Om)) * sin(kx))))));
} else {
tmp = sqrt((0.5 + (0.5 * (1.0 / hypot(1.0, (2.0 / ((Om / l) / sin(ky))))))));
}
return tmp;
}
public static double code(double l, double Om, double kx, double ky) {
double tmp;
if (ky <= 7.6e-222) {
tmp = Math.sqrt((0.5 + (0.5 / Math.hypot(1.0, ((2.0 * (l / Om)) * Math.sin(kx))))));
} else {
tmp = Math.sqrt((0.5 + (0.5 * (1.0 / Math.hypot(1.0, (2.0 / ((Om / l) / Math.sin(ky))))))));
}
return tmp;
}
def code(l, Om, kx, ky): tmp = 0 if ky <= 7.6e-222: tmp = math.sqrt((0.5 + (0.5 / math.hypot(1.0, ((2.0 * (l / Om)) * math.sin(kx)))))) else: tmp = math.sqrt((0.5 + (0.5 * (1.0 / math.hypot(1.0, (2.0 / ((Om / l) / math.sin(ky)))))))) return tmp
function code(l, Om, kx, ky) tmp = 0.0 if (ky <= 7.6e-222) tmp = sqrt(Float64(0.5 + Float64(0.5 / hypot(1.0, Float64(Float64(2.0 * Float64(l / Om)) * sin(kx)))))); else tmp = sqrt(Float64(0.5 + Float64(0.5 * Float64(1.0 / hypot(1.0, Float64(2.0 / Float64(Float64(Om / l) / sin(ky)))))))); end return tmp end
function tmp_2 = code(l, Om, kx, ky) tmp = 0.0; if (ky <= 7.6e-222) tmp = sqrt((0.5 + (0.5 / hypot(1.0, ((2.0 * (l / Om)) * sin(kx)))))); else tmp = sqrt((0.5 + (0.5 * (1.0 / hypot(1.0, (2.0 / ((Om / l) / sin(ky)))))))); end tmp_2 = tmp; end
code[l_, Om_, kx_, ky_] := If[LessEqual[ky, 7.6e-222], N[Sqrt[N[(0.5 + N[(0.5 / N[Sqrt[1.0 ^ 2 + N[(N[(2.0 * N[(l / Om), $MachinePrecision]), $MachinePrecision] * N[Sin[kx], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(0.5 + N[(0.5 * N[(1.0 / N[Sqrt[1.0 ^ 2 + N[(2.0 / N[(N[(Om / l), $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;ky \leq 7.6 \cdot 10^{-222}:\\
\;\;\;\;\sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, \left(2 \cdot \frac{\ell}{Om}\right) \cdot \sin kx\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 + 0.5 \cdot \frac{1}{\mathsf{hypot}\left(1, \frac{2}{\frac{\frac{Om}{\ell}}{\sin ky}}\right)}}\\
\end{array}
\end{array}
if ky < 7.59999999999999993e-222Initial program 96.5%
distribute-rgt-in96.5%
metadata-eval96.5%
metadata-eval96.5%
associate-/l*96.5%
metadata-eval96.5%
Simplified96.5%
add-log-exp96.5%
add-sqr-sqrt96.5%
hypot-1-def96.5%
sqrt-prod96.5%
unpow296.5%
sqrt-prod61.2%
add-sqr-sqrt98.9%
div-inv98.9%
clear-num98.9%
Applied egg-rr100.0%
Taylor expanded in ky around 0 93.9%
expm1-log1p-u93.4%
expm1-udef93.4%
Applied egg-rr93.4%
expm1-def93.4%
expm1-log1p93.9%
fma-udef93.9%
associate-*r/93.9%
metadata-eval93.9%
Simplified93.9%
if 7.59999999999999993e-222 < ky Initial program 99.1%
distribute-rgt-in99.1%
metadata-eval99.1%
metadata-eval99.1%
associate-/l*99.1%
metadata-eval99.1%
Simplified99.1%
add-log-exp99.1%
add-sqr-sqrt99.1%
hypot-1-def99.1%
sqrt-prod99.1%
unpow299.1%
sqrt-prod53.6%
add-sqr-sqrt99.3%
div-inv99.3%
clear-num99.3%
Applied egg-rr100.0%
Taylor expanded in kx around 0 98.8%
associate-*r/98.8%
*-commutative98.8%
Simplified98.8%
add-log-exp98.8%
associate-/l*98.8%
associate-/l/98.8%
Applied egg-rr98.8%
Final simplification96.0%
(FPCore (l Om kx ky) :precision binary64 (sqrt (+ 0.5 (/ 0.5 (hypot 1.0 (* (* 2.0 (/ l Om)) (sin kx)))))))
double code(double l, double Om, double kx, double ky) {
return sqrt((0.5 + (0.5 / hypot(1.0, ((2.0 * (l / Om)) * sin(kx))))));
}
public static double code(double l, double Om, double kx, double ky) {
return Math.sqrt((0.5 + (0.5 / Math.hypot(1.0, ((2.0 * (l / Om)) * Math.sin(kx))))));
}
def code(l, Om, kx, ky): return math.sqrt((0.5 + (0.5 / math.hypot(1.0, ((2.0 * (l / Om)) * math.sin(kx))))))
function code(l, Om, kx, ky) return sqrt(Float64(0.5 + Float64(0.5 / hypot(1.0, Float64(Float64(2.0 * Float64(l / Om)) * sin(kx)))))) end
function tmp = code(l, Om, kx, ky) tmp = sqrt((0.5 + (0.5 / hypot(1.0, ((2.0 * (l / Om)) * sin(kx)))))); end
code[l_, Om_, kx_, ky_] := N[Sqrt[N[(0.5 + N[(0.5 / N[Sqrt[1.0 ^ 2 + N[(N[(2.0 * N[(l / Om), $MachinePrecision]), $MachinePrecision] * N[Sin[kx], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, \left(2 \cdot \frac{\ell}{Om}\right) \cdot \sin kx\right)}}
\end{array}
Initial program 97.6%
distribute-rgt-in97.6%
metadata-eval97.6%
metadata-eval97.6%
associate-/l*97.6%
metadata-eval97.6%
Simplified97.6%
add-log-exp97.7%
add-sqr-sqrt97.7%
hypot-1-def97.7%
sqrt-prod97.7%
unpow297.7%
sqrt-prod57.9%
add-sqr-sqrt99.1%
div-inv99.1%
clear-num99.1%
Applied egg-rr100.0%
Taylor expanded in ky around 0 92.2%
expm1-log1p-u91.7%
expm1-udef91.7%
Applied egg-rr91.7%
expm1-def91.7%
expm1-log1p92.2%
fma-udef92.2%
associate-*r/92.2%
metadata-eval92.2%
Simplified92.2%
Final simplification92.2%
(FPCore (l Om kx ky)
:precision binary64
(if (<= Om -4.7e-30)
1.0
(if (<= Om -6e-120)
(sqrt 0.5)
(if (<= Om -1.45e-148) 1.0 (if (<= Om 1e-10) (sqrt 0.5) 1.0)))))
double code(double l, double Om, double kx, double ky) {
double tmp;
if (Om <= -4.7e-30) {
tmp = 1.0;
} else if (Om <= -6e-120) {
tmp = sqrt(0.5);
} else if (Om <= -1.45e-148) {
tmp = 1.0;
} else if (Om <= 1e-10) {
tmp = sqrt(0.5);
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(l, om, kx, ky)
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8) :: tmp
if (om <= (-4.7d-30)) then
tmp = 1.0d0
else if (om <= (-6d-120)) then
tmp = sqrt(0.5d0)
else if (om <= (-1.45d-148)) then
tmp = 1.0d0
else if (om <= 1d-10) then
tmp = sqrt(0.5d0)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double l, double Om, double kx, double ky) {
double tmp;
if (Om <= -4.7e-30) {
tmp = 1.0;
} else if (Om <= -6e-120) {
tmp = Math.sqrt(0.5);
} else if (Om <= -1.45e-148) {
tmp = 1.0;
} else if (Om <= 1e-10) {
tmp = Math.sqrt(0.5);
} else {
tmp = 1.0;
}
return tmp;
}
def code(l, Om, kx, ky): tmp = 0 if Om <= -4.7e-30: tmp = 1.0 elif Om <= -6e-120: tmp = math.sqrt(0.5) elif Om <= -1.45e-148: tmp = 1.0 elif Om <= 1e-10: tmp = math.sqrt(0.5) else: tmp = 1.0 return tmp
function code(l, Om, kx, ky) tmp = 0.0 if (Om <= -4.7e-30) tmp = 1.0; elseif (Om <= -6e-120) tmp = sqrt(0.5); elseif (Om <= -1.45e-148) tmp = 1.0; elseif (Om <= 1e-10) tmp = sqrt(0.5); else tmp = 1.0; end return tmp end
function tmp_2 = code(l, Om, kx, ky) tmp = 0.0; if (Om <= -4.7e-30) tmp = 1.0; elseif (Om <= -6e-120) tmp = sqrt(0.5); elseif (Om <= -1.45e-148) tmp = 1.0; elseif (Om <= 1e-10) tmp = sqrt(0.5); else tmp = 1.0; end tmp_2 = tmp; end
code[l_, Om_, kx_, ky_] := If[LessEqual[Om, -4.7e-30], 1.0, If[LessEqual[Om, -6e-120], N[Sqrt[0.5], $MachinePrecision], If[LessEqual[Om, -1.45e-148], 1.0, If[LessEqual[Om, 1e-10], N[Sqrt[0.5], $MachinePrecision], 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;Om \leq -4.7 \cdot 10^{-30}:\\
\;\;\;\;1\\
\mathbf{elif}\;Om \leq -6 \cdot 10^{-120}:\\
\;\;\;\;\sqrt{0.5}\\
\mathbf{elif}\;Om \leq -1.45 \cdot 10^{-148}:\\
\;\;\;\;1\\
\mathbf{elif}\;Om \leq 10^{-10}:\\
\;\;\;\;\sqrt{0.5}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if Om < -4.69999999999999969e-30 or -6.00000000000000022e-120 < Om < -1.4499999999999999e-148 or 1.00000000000000004e-10 < Om Initial program 99.3%
distribute-rgt-in99.3%
metadata-eval99.3%
metadata-eval99.3%
associate-/l*99.3%
metadata-eval99.3%
Simplified99.3%
add-log-exp99.3%
add-sqr-sqrt99.3%
hypot-1-def99.3%
sqrt-prod99.3%
unpow299.3%
sqrt-prod61.4%
add-sqr-sqrt100.0%
div-inv100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in l around 0 84.8%
if -4.69999999999999969e-30 < Om < -6.00000000000000022e-120 or -1.4499999999999999e-148 < Om < 1.00000000000000004e-10Initial program 95.1%
distribute-rgt-in95.1%
metadata-eval95.1%
metadata-eval95.1%
associate-/l*95.1%
metadata-eval95.1%
Simplified95.1%
Taylor expanded in Om around 0 77.7%
*-commutative77.7%
associate-*r*77.7%
associate-*l/77.7%
unpow277.7%
unpow277.7%
hypot-def80.7%
associate-*l/80.7%
*-commutative80.7%
Simplified80.7%
Taylor expanded in l around inf 83.4%
Final simplification84.2%
(FPCore (l Om kx ky) :precision binary64 (sqrt 0.5))
double code(double l, double Om, double kx, double ky) {
return sqrt(0.5);
}
real(8) function code(l, om, kx, ky)
real(8), intent (in) :: l
real(8), intent (in) :: om
real(8), intent (in) :: kx
real(8), intent (in) :: ky
code = sqrt(0.5d0)
end function
public static double code(double l, double Om, double kx, double ky) {
return Math.sqrt(0.5);
}
def code(l, Om, kx, ky): return math.sqrt(0.5)
function code(l, Om, kx, ky) return sqrt(0.5) end
function tmp = code(l, Om, kx, ky) tmp = sqrt(0.5); end
code[l_, Om_, kx_, ky_] := N[Sqrt[0.5], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{0.5}
\end{array}
Initial program 97.6%
distribute-rgt-in97.6%
metadata-eval97.6%
metadata-eval97.6%
associate-/l*97.6%
metadata-eval97.6%
Simplified97.6%
Taylor expanded in Om around 0 43.4%
*-commutative43.4%
associate-*r*43.4%
associate-*l/43.4%
unpow243.4%
unpow243.4%
hypot-def44.6%
associate-*l/44.6%
*-commutative44.6%
Simplified44.6%
Taylor expanded in l around inf 53.9%
Final simplification53.9%
herbie shell --seed 2023187
(FPCore (l Om kx ky)
:name "Toniolo and Linder, Equation (3a)"
:precision binary64
(sqrt (* (/ 1.0 2.0) (+ 1.0 (/ 1.0 (sqrt (+ 1.0 (* (pow (/ (* 2.0 l) Om) 2.0) (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))))))