Vb6 Double vs Vb.Net Double data type PLEASE...

amitch0219

Member
Joined
Aug 11, 2010
Messages
5
Programming Experience
10+
Hi Guys
I need some serious help on this one.

When i use VB6 i get the following outputs
961.605 * 100 = 96161

936.495 * 100 = 93650

929.295 * 100 = 92929

NOW..... When i do the above in vb.net 2005 i get the following
961.605 * 100 = 96160

936.495 * 100 = 93650

929.295 * 100 = 92930

How can i get the same output as the VB results. And i have tired it ! Type conversions, math functions, everything i can think of to get the same VB6 output !

PLEASE HELP !
 
I tried the Math.round, with both options, ToEven and AwayFromZero.
The results still do not match with the vb6 results. its like the decimals have a mind of their own !
 
VB.NET:
Dim result = Math.Round(961.605 * 100, 0, MidpointRounding.AwayFromZero)
result = 96161.0 (rounded Double value)
 
yes i tired that,
however if you do Math.Round(929.295 * 100, 0, MidpointRounding.AwayFromZero) = 92930
in VB6 929.295 * 100 gives you = 92929
I cannot change the VB6 code cause its been in production for YEARS ! so i gotta tweak the .net code and i just cannot get it to work to match the vb6 results !
 
in VB6 929.295 * 100 gives you = 92929
Does it? What kind of logic is that? That would be a 'ToOdd', 'TowardsZero', or Math.Floor possibly.
961.605 * 100 = 96161
Here you have AwayFromZero, or Math.Ceiling perhaps.
936.495 * 100 = 93650
And here AwayFromZero / ToEven / Math.Ceiling.
 
Back
Top