# Fit frame to (flushright) text

I would like the frame to fit the text inside?

\documentclass[a4paper]{memoir}
\usepackage{mdframed}
\begin{document}
\begin{flushright}
\begin{framed}
$\textsc{casregner}$
$(f(x)=g(x),x)|x>0$
$x=32.5552$
\end{framed}
\end{flushright}
\end{document}


\documentclass[a4paper]{memoir}
$\textsc{casregner}$
$(f(x)=g(x),x)|x>0$
$x=32.5552$}