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)

Math.Ceil Function equivalent

(0) ShareShare
ReportReport
Posted on by

Hi all,

 

I am after an equivalent Math.ceiling function for Decimal/Double/Real numbers in AX 2012 X++ programming. I would like to round up to the the next whole Decimal but can't seem to get the desired outcome using decRound(Number, 0) or  round(Number, 1).

For example if Number is 1.10 I want the output to be 2

Please help! Thanks.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Kyle Wascher Profile Picture
    185 on at

    You can use .NET inside x++.

    static void Job1(Args _args)

    {

       real testNum = 1.10;

       real result;

       result = System.Math::Ceiling(testNum);

       info(strFmt("%1", result));

    }

  • Verified answer
    Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    Using .NET Interop from X++ works, but it's slow, may require Interop permission and so on.

    You can do the same in X++ by roundUp(number, 1) or roundUpDec(number, 0).

  • Community Member Profile Picture
    on at

    Many thanks Kyle and Martin. The roundUp() function worked for me but not the System.Math::Ceiling()

  • MukeshHirwani Profile Picture
    1,180 on at

    static void Job1(Args _args)

    {

       real i = 1.10;

       print round(i,2);

       pause;

    }

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans