2017-05-09 18:57:38 -0500 received badge ● Famous Question (source) 2016-03-31 02:45:51 -0500 received badge ● Notable Question (source) 2016-03-31 02:45:51 -0500 received badge ● Popular Question (source) 2014-02-17 06:42:25 -0500 received badge ● Scholar (source) 2014-02-17 06:42:25 -0500 marked best answer Cutting unnecessary zeroes in float numbers You could just check that type(x) == float  Or, instead of round, you could use python's string formatter. "{:.5g}".format(x)  will format x using 5 digits of precision (including before and after the decimal separator), removing trailing zeroes and the decimal dot for integers. Not exactly equivalent to your code, but maybe it will be good enough for your use. If you have a locale configured for French/Italian/whatever notation "{:.5n}".format(x)  will automatically put a comma instead of a dot for you. 2014-02-17 06:42:19 -0500 received badge ● Supporter (source) 2014-02-17 06:30:28 -0500 answered a question Cutting unnecessary zeroes in float numbers That was really dumb. \begin{sagesilent} def numprint(x): x = round(x, ndigits=3) x = latex(x) x = str(x) x = x.replace('.', ',\!').replace('\\times','\, \ldotp') x = x.rstrip('0').rstrip(',\!') if ',\!' in x else x x = sage.misc.latex.LatexExpr(x) return x \end{sagesilent} \newcommand{\sagedot}[1]{\sagestr{numprint(RDF(#1))}}  Maybe this solution is dumb too, but it works :D 2014-02-17 05:49:59 -0500 received badge ● Editor (source) 2014-02-17 05:49:32 -0500 asked a question Cutting unnecessary zeroes in float numbers Hello. I have function, which shows a float number with comma instead of dot. But if i use this function on integer 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','\, \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 2014-02-15 00:00:52 -0500 answered a question Using comma as a decimal mark with SageTeX 2014-02-14 03:19:35 -0500 received badge ● Student (source) 2014-02-14 02:04:24 -0500 asked a question Using comma as a decimal mark with SageTeX There are a lot of questions about how-to use comma instead of dot in standart LaTeX documents. But how i can do this in documents with SageTeX? 2014-02-14 02:03:24 -0500 asked a question Using comma as a decimal mark with SageTeX There are a lot of questions about how-to use comma instead of dot in standart LaTeX documents. But how i can do this in documents with SageTeX?