cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Jefvanhoutven
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
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
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.
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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Users online (7,078)