web
You’re offline. This is a read only version of the page.
close
Skip to main content
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)
  • MukeshHirwani Profile Picture
    1,180 on at
    RE: Math.Ceil Function equivalent

    static void Job1(Args _args)

    {

       real i = 1.10;

       print round(i,2);

       pause;

    }

  • Community Member Profile Picture
    on at
    RE: Math.Ceil Function equivalent

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

  • Verified answer
    Martin Dráb Profile Picture
    235,959 Most Valuable Professional on at
    RE: Math.Ceil Function equivalent

    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).

  • Suggested answer
    Kyle Wascher Profile Picture
    185 on at
    RE: Math.Ceil Function equivalent

    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));

    }

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#2
doninep Profile Picture

doninep 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans