cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Multiplying float variables gives wrong result

When multiplying following variables of the type float, using the mul() function, the result is incorrect.


variable a = 0.0167
variable b = 5
result a * b gives 0.08349999999999999 instead of 0.0835

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Multiplying float variables gives wrong result

 

Hi @Jefvanhoutven ,

 

Update of this issue:

 

Currently, this is by Design for the 'mul' function.

 

What we can do is use the formatNumber function and specify the number of digits after the decimal. documentation - https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#f...

 

example - using the below will have the expected result (4 digits round off after decimal)

 

formatNumber(mul(variables('a'), variables('b')), 'F04')

 

Hope this helps.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Multiplying float variables gives wrong result

 

Hi @Jefvanhoutven ,

 

Thank you for the feedback!

I could reproduce this issue on my side.

We report this issue and if there are any updates, we will post back.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Community Support
Community Support

Re: Multiplying float variables gives wrong result

 

Hi @Jefvanhoutven ,

 

Update of this issue:

 

Currently, this is by Design for the 'mul' function.

 

What we can do is use the formatNumber function and specify the number of digits after the decimal. documentation - https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#f...

 

example - using the below will have the expected result (4 digits round off after decimal)

 

formatNumber(mul(variables('a'), variables('b')), 'F04')

 

Hope this helps.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Users online (6,363)