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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Floating point errors

Hi All,

 

There's an annoying bug I discovered and it's easy to replicate.

Create a measure

Test = (3/60)*0.80 > 0.04

It will return "True". Basically, Power BI is telling you that 0.04 is bigger than 0.04.

 

Regards,

Me

Status: Accepted
Comments
v-yulgu-msft
Employee

Hi @Anonymous ,

 

I have reported this problem internally, CRI:113755404. Would update here once I get any response.

 

Best regards,

Yuliana Gu

v-yulgu-msft
Employee

Hi @Anonymous ,

 

I got response from PG as follows:

 

This is a known limitation of decimal number data type. Power BI's decimal number data type is implemented as IEEE Standard 754 Floating Point Numbers. IEEE floating pointer numbers have rounding errors therefore comparison of two numbers with close values may lead to surprising results. See https://floating-point-gui.de/errors/comparison/ to examples. Users can switch to fixed decimal number data type or use epsilon comparison as described in https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/

 

Best regards,

Yuliana Gu

v-yulgu-msft
Employee
Status changed to: Accepted
 
Anonymous
Not applicable

Excel doesn't have that problem though?

When you select the Format and decimal place under Modeling -> Formatin, it doesn't affect the floating point at all.

Like this abomination (below). Constant is 3.80 with formating selected to "Whole Number".

Untitled.jpg

 

It's going to be a pain having to use Round() on every measure before comparing them...