How to get the precision value of a given number.

Hi all…

I am passing a real number as a parameter to a method… I want the precision value of the parameter into another variable… how can I achieve it…

Thanks in advance…

I am not an AX developer, but why not round the value to a whole number and subtract

MyValue := 123.45

MyRemainder := MyValue - ROUND(myValue,1) ;

Returning the .45

David

Thanks for the reply… But this solution has a problem…

If precision value is less than .5 it returns correct answer, but otherwise gives the wrong answer.

If value is 123.45, it returns .45

If value is 123.60, it returns .40… Since round(123.60) is 124 … I require the answer as .60.

Not sure about AX in Navision we can give a direction to round down:

MyValue := 123.45

MyRemainder := MyValue - ROUND(myValue,1, ‘<’) ;

Returning the .45

David

Hi david… This is not working in AX…

Is there anyother way to get the exact precision value…

If value is 45.7 , I need the value .7 …

regards,

Satya.

Can you use the MOD function as

45.7 MOD 1

This will return the remainder as .7

I have just Googled it and MOD does only works on whole numbers in AX but there is a function frac() to return the fraction and trunc() returns the fraction as a whole number in AX

frac() function http://msdn.microsoft.com/en-us/library/aa850054.aspx

trunc() function http://msdn.microsoft.com/en-us/library/aa865457.aspx

David

Thanks david…

frac() function is working.