I am trying to get the absolute value of a decimal value but sth is wrong.
The value is -1.24 but the absolute value i get is 1.
Have a look please. What could be wrong?
I am trying to get the absolute value of a decimal value but sth is wrong.
The value is -1.24 but the absolute value i get is 1.
Have a look please. What could be wrong?
@the.christopoulos
Yes it coming correct ,the absolute value of 1.24 is 1 where as absolute value of 1.5 is 2
My question is do you want to get 1.24 as answer
@amalmarella I want to get the positive value if its negative and keep the positive value if it is.
example
if -1.24 then get 1.24
if 1.24 then get 1.24
@the.christopoulos
Then use Cint(variablename)
In this case it is Cint(value2)
Cint means convert to integer
@amalmarella If i convert to integer there are no decimal values.
I want to keep the number as it was with decimals : 1.24
Hi,
In this case, it seems Math.Abs method recognized value2 as not Decimal but Int32 due to GenericValue feature. So, perhaps you should set type of values2 as Decimal (or Double).
Regards,