web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

DecRound not working as expected sometimes

(0) ShareShare
ReportReport
Posted on by 5

I have to round some field data with 2 decimal positions, when i run it in a job (client side), it just works as expected:

Screenshot_5F00_20190416_5F00_102510.png

it works because, in this case, i want to get 110.03, that is the right number rounded.

But, when i try to use this one in a web service (server side), it just does not get rounded, i just get 110.02, instead of 110.03 (the right value). See the image:

Screenshot_5F00_20190416_5F00_102211.png

See decRounded, the value is 110.025, and this rounded should be 110.03 instead of 110.02,

Is there a reason for this behavior?

*This post is locked for comments

I have the same question (0)
  • mpinto198 Profile Picture
    5 on at

    docs.microsoft.com/.../system.math.round;view=netframework-4.7.2#System_Math_Round_System_Double_System_Int32_System_MidpointRounding_

    I have to use System.Math.Round, to fix this behavior.

    System.Math::Round(value,decimals,System.MidpointRounding::AwayFromZero)

    The MidpointRounding::AwayFromZero was the trick.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Sagar Suman Profile Picture

Sagar Suman 2 Super User 2026 Season 1

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans