I have an issue with Flow calculating incorrectly.
variables('months') = 36 body('Get_record')?['netamount'] = 4704.48
Now, if I put this in a calculator. It solves to:
4704.48 * 100 = 470448 470448 / 36 = 13068
It seems that flow is not that good in calculating..?
Issue is that I need to round down the number that I get.
Yes I might be able to round by the Xth number or sth. but why can't it just calculate correctly in the first place?
Hi @Serf ,
This is very strange. It seems like this issue is coming from the multiply expression. Take a look at what I did below. For some reason the mul(4704.48,100) expression when initialized in a float variable results in 470447.99999...
Let me follow up on my end and see if I can discover why this is happening.
This is actually something called floating-point arithmetic that most programming languages deal with. They follow the following IEEE standard:
I am working on figuring out a way to potentially do a rounding of sorts to get the correct number. You can see this reproduced in C# below.
I would be wary of this solution, as I have not tested it extensively, but Flow is very limited on mathematical functions.
If you expect the number to always be a whole number, you can use the following equation in a compose action to convert the number to a string (which somehow rounds the number), split it between the decimal place, take the first part of the split which is your number, and then convert it to an integer.
Check out the News & Announcements to learn more.
Participate in the Power Virtual Agents Community Challenge
Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.
DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.