Question

I need to do calculations (division or multiplication) with very large numbers. Currently I am using Double and getting the value round off problems. I can do the same calculations accurately on C# using Decimal type. I am looking for a method to do accurate calculations in VB6.0 and I couldn't find a Decimal type in VB6.0.

What is the data type used for doing arithmetic calculations with large values and without getting floating point round off problems?

Was it helpful?

Solution

Depending on your data type, you can always use Currency, which is like Decimal(19,4), or 15 digits to the left of the decimal point, and 4 to the right.

In VB6, try using the variant datatype, and casting your numbers to that using CDec, as in:

Dim myDec As Variant
myDec = CDec(1.234)

See if that works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top