ABS Function returning number in exp notation

I’m beating my head against the wall on this one. It should be very straight forward. I want the positive value of a number which should be what the ABS function does. Right?

Every time I pass a whole number such as 29988 I end up with the exp notation. If factor = .01 then Abs(amt.DoubleValue * factor) should = 299.88

``` Dim amt As Variant if Absolute then // Here, amt = 29988 amt = Abs(amt.DoubleValue * factor) // Here, amt = 2.998e+4 else amt = amt.DoubleValue * factor end if ```

I can’t replicate your results, so I’m guessing `factor` isn’t what you think it is. I get 2.9988e+2 with this code:

``````  dim amt as Variant = 29988
dim factor as double = 0.01
amt = Abs( amt.DoubleValue * factor )``````

I found that by returning amt.CurrencyValue I end up with 299.8800 if factor = .01. I guess I shouldn’t get too hung up on the numeric representation of a number.

That’s true, but the code you posted says that were actually getting the wrong result. 2.998e+4 = 29980. Did you mean to write 2.998e+2?

BTW, why use a variant at all?

What you end up with is a number, not a notation. The notation of the number is what you get when you convert the number to a string using Str or Format, and you can pass a parameter specifying the desired format (i.e. if you dont want scientific notation).