Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Recognizing float numbers

Hello. I have function, which shows a FLOAT number with comma instead of dot. But if i use this function on INT number it shows FLOAT number. Here is the function

\begin{sage.} def numprint(x): x = round(x, ndigits=3) x = latex(x) x = str(x) x = x.replace('.', ',!').replace('\times','\, \ldotp') x = sage.misc.latex.LatexExpr(x) return x \end{sage} \newcommand{\sagedot}[1]{\sagestr{numprint(RDF(#1))}}

So, when i use \sagedot{3} it shows 3.0 instead of 3. Help me to improve it. Thanks and sorry for dumb english and question :D

Recognizing float numbers

Hello. I have function, which shows a FLOAT number with comma instead of dot. But if i use this function on INT number it shows FLOAT number. Here is the function

\begin{sage.} \begin{sagesilent.} def numprint(x): x = round(x, ndigits=3) x = latex(x) x = str(x) x = x.replace('.', ',!').replace('\times','\, \ldotp') x = sage.misc.latex.LatexExpr(x) return x \end{sage} \newcommand{\sagedot}[1]{\sagestr{numprint(RDF(#1))}}

So, when i use \sagedot{3} it shows 3.0 instead of 3. Help me to improve it. Thanks and sorry for dumb english and question :D

Recognizing float numbers

Hello. I have function, which shows a FLOAT number with comma instead of dot. But if i use this function on INT number it shows FLOAT number. Here is the function

\begin{sagesilent.}
  def numprint(x):
     x = round(x, ndigits=3)
     x = latex(x)
     x = str(x)
     x = x.replace('.', ',!').replace('\times','\, ',\!').replace('\\times','\, \ldotp')
     x = sage.misc.latex.LatexExpr(x)
     return x
\end{sage}
\newcommand{\sagedot}[1]{\sagestr{numprint(RDF(#1))}}

\newcommand{\sagedot}[1]{\sagestr{numprint(RDF(#1))}}

So, when i use \sagedot{3} \sagedot{3} it shows 3.0 instead of 3. Help me to improve it. Thanks and sorry for dumb english and question :D

Recognizing float numbers

Hello. I have function, which shows a FLOAT number with comma instead of dot. But if i use this function on INT number it shows FLOAT number. Here is the function

\begin{sagesilent.}
\begin{sagesilent}
  def numprint(x):
     x = round(x, ndigits=3)
     x = latex(x)
     x = str(x)
     x = x.replace('.', ',\!').replace('\\times','\, \ldotp')
     x = sage.misc.latex.LatexExpr(x)
     return x
\end{sage}
\newcommand{\sagedot}[1]{\sagestr{numprint(RDF(#1))}}

So, when i use \sagedot{3} it shows 3.0 instead of 3. Help me to improve it. Thanks and sorry for dumb english and question :D

Recognizing Cutting unnecessary zeroes in float numbers

Hello. I have function, which shows a FLOAT float number with comma instead of dot. But if i use this function on INT number integer it shows FLOAT float number. Here is the function

\begin{sagesilent}
  def numprint(x):
     x = round(x, ndigits=3)
     x = latex(x)
     x = str(x)
     x = x.replace('.', ',\!').replace('\\times','\, \ldotp')
     x = sage.misc.latex.LatexExpr(x)
     return x
\end{sage}
\newcommand{\sagedot}[1]{\sagestr{numprint(RDF(#1))}}

So, when i use \sagedot{3} it shows 3.0 instead of 3. Help me to improve it. Thanks and sorry for dumb english and question :D