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
static void Job1(Args _args)
{
real i = 1.10;
print round(i,2);
pause;
}
Many thanks Kyle and Martin. The roundUp() function worked for me but not the System.Math::Ceiling()
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).
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));
}
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156