I've come across this anomaly and wondered if anybody could shed some light on it for me. I've fixed the problem by using a Single instead of a Double, but am curious as to why the problem arises in the first place.
* I'm using a SQL Server database containing a table with a field that stores a decimal number to a precision of 4 decimal places.
* A stored procedure returns that number as a REAL.
* The stored procedure is called from VB and the return value (temporarily stored in a variant, in an array) is assigned to a Double variable.
* The value stored in the table is (for example) 1.5384. The value that ends up in the Double is (for example) 1.5384004020451. How/why does that happen? I'd have thought that the extra precision would be padded out with zeroes if necessary, not random digits.
* If I assign the value to a variable of type Single, then it's fine.
TIA,
gkrogers
* I'm using a SQL Server database containing a table with a field that stores a decimal number to a precision of 4 decimal places.
* A stored procedure returns that number as a REAL.
* The stored procedure is called from VB and the return value (temporarily stored in a variant, in an array) is assigned to a Double variable.
* The value stored in the table is (for example) 1.5384. The value that ends up in the Double is (for example) 1.5384004020451. How/why does that happen? I'd have thought that the extra precision would be padded out with zeroes if necessary, not random digits.
* If I assign the value to a variable of type Single, then it's fine.
TIA,
gkrogers