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

Notifications

Announcements

No record found.

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
    237,948 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans