Results 1 to 2 of 2

Thread: VB/VBS

  1. #1
    Join Date
    Dec 1969

    Default VB/VBS

    I have VB code converted to VBS, when I run both codes against same data, a report get generated, the report has orders and the total cost for these them. <BR>Now the problem is the total I get running the tow code against the same data is unequal, the one generated by vbs is short in few cents. The code very much same in dealing with these amounts and in the way it pull them out the amounts from the database. <BR>Any suggestion <BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default Tough to guess...

    ...with so little information to go on.<BR><BR>My first guess would be that VB is treating the data as a Currency data type and doing arithmetic in Currency form.<BR><BR>VBScript, on the other hand, can&#039;t do arithmetic in Currency form. SO it converts the currency values to floating point (same thing as doing CDBL) and does the work there.<BR><BR>The other possibility is that VB is indeed using DOUBLE data and doing DOUBLE arithmetic, whereas VBScript is doing SINGLE arithmetic. SINGLE numbers are only going to be correct to about 6 and half digits, so 987654.30 and 987654.25 are almost surely going to be the same SINGLE value. Double, on the other hand, is accurate to 14 digits.<BR><BR>See if you can&#039;t narrow the problem down to the very least possible code and then post both versions of the code.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts