# Why doesn't the Round function work on decimals and how to fix it or work around it [duplicate]

I'm trying to specify yaxis tick labels from 0 to 1.0 in steps of 0.1. This is what I get:

ygrids=Range[0,1.0,0.1];
0.,0.1,0.2,0.30000000000000004,0.4,0.5,0.6000000000000001,0.7000000000000001,0.8,0.9,1.}


Round[ygrids,0.01] doesn't fix it. (0.001 fixes all but the 7.0000x)

This is too simple to be this hard!

Help appreciated (version 10.1)

• Round[ygrids, 1/10] // N, Range[0, 1, 1/10] // N,N@Rationalize@Range[0, 1.0, 0.1]... – ciao Aug 12 '15 at 0:56
• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Michael E2 Aug 12 '15 at 1:02
• You can format inline code and code blocks by selecting the code and clicking the {} button above the edit window. The edit window help button ? is also useful for learning how to format your questions and answers. You may also find this this meta Q&A helpful – Michael E2 Aug 12 '15 at 1:02
• This needs to be marked as a duplicate, not closed as a "simple mistake." – Mr.Wizard Aug 12 '15 at 2:08
• A few links: (2915), (5580), (14122), (14511), (39126), (65298), (75528), (78298) – Mr.Wizard Aug 12 '15 at 2:12

I think you should cut the Gordian Knot and forget about rounding.

Plot[x, {x, 0, 1}, Ticks -> {Automatic, Range[0., 1., .1]}]


The lack of rounding has no visible affect on the plot.

• Yes, I will give this a try next time as I like the simplicity. I hope it works on more complicated graph axis ticks as well. – Tom Mozdzen Aug 12 '15 at 16:27