"Dean G" <bi********@hotmail.com> wrote in message
news:%2********************@TK2MSFTNGP11.phx.gbl.. .
thanks manohar that did the trick, i still had to change it from decimal
to float before it would work though, if anyone has the same problem.
Decimals are weird little creatures in VBScript. Unlike integers, longs,
etc... they are not a recognized variant subtype. Let me qualify that by
saying VarType() will return 14, but TypeName() will fail. Try
TypeName(decimalvalue) and you will receive the following error:
"Variable uses an Automation type not supported in VBScript"
So when performing arithmetic operations, one is forced to convert
decimals to a supported subtype using functions such as CInt,CDbl, and
most importantly CCur. The reason I emphasize CCur is that the currency
subtype is in fact a decimal with 4 point precision, masquerading as a
supported VBScript variant subtype. The problem with CInt is that you
lose data on the conversion and the problem with CDbl is that they
represent approximations of a number. It's beyond the scope of this
thread but basically it has to do with the fact that computers represent
numbers (and everything else) in binary. As such if a number cannot be
represented as the sum of the powers of 2, an approximation is made.
Response.Write 1 - .94
6.00000000000001E-020.99
So when dealing with decimals of precision less than or equal to 4, CCur
is a good choice.