Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
katizabogar
New Member

List.Numbers() with step of 0.1 creates smallest decimal points

Hi,
when I create a list in Power Query M by

= List.Numbers(0, 25/0.1+1, 0.1)

I get smallest decimal points for some numbers (e.g. I get 0.30000000000000004 instead of 0.3 and 0,60000000000000009 instead of 0.6, but 0.1, 0.2, 0.4 and 0.5 are correct).
What's the reason and how can I fix it?

1 ACCEPTED SOLUTION

 

The WHY is due to floating point numbers i.e. how computers calculate base-10 fractions using binary.

Tom Scott explains it better than I ever could here:

https://www.youtube.com/watch?v=PZRI1IfStY0 

 

The solution is to be aware of it and round it out of your calculations, or use the most granular unit as an integer e.g. pence, not fractions of pounds etc.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

3 REPLIES 3
BA_Pete
Super User
Super User

Hi @katizabogar ,

 

Not sure what's causing that as I can't replicate the issue. It works perfectly at my end.

 

However, you could try something like this if you're still getting the issue:

= List.Transform(
    List.Numbers(0, 25/0.1+1, 0.1),
    each Number.Round(_, 1)
)

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




The decimal places are not directly visible in the list. Only when I click on e.g. 0.3 I see in the window below that the field actually contains the number 0.300000000000004. Is this not the case with you?
Your solution with the rounding works, thanks.
However, I'm afraid that similar errors are more often the reason why my code doesn't work and I'd like to understand why that is, instead of always just post-processing the output.

 

The WHY is due to floating point numbers i.e. how computers calculate base-10 fractions using binary.

Tom Scott explains it better than I ever could here:

https://www.youtube.com/watch?v=PZRI1IfStY0 

 

The solution is to be aware of it and round it out of your calculations, or use the most granular unit as an integer e.g. pence, not fractions of pounds etc.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors