It is very hard to find anything really definitive about the differences when selecting those compiler optimizations.
Since code generation is done using a modfied version of c2.dll (as c2.exe, which is run by vb6.exe after it completes pass 1) you might look at the VC 6.0 compiler optimization switches and their docs.
One thing I saw mentioned on MSDN when I tried following the breadcrumbs was that for "fast code" the compiler inserts some operations as inline code instead of calls into a library (in this case probably the VB6 runtime). So rounding seems a very likely difference.
While it's no comfort now, programmers really should not be using implicit coercion in anything that is sensitive. And even then they usually should be weighing the options (whether to use CLng(), Fix(), Int(), Round(), etc.) and following up with testing. As we see here, that testing almost needs to include tests as p-code and native code using various optimization settings.
We're all guilty of this though. I've cetainly written stuff like:
Code:
Dim A(0 To 9) As Single
Dim I As Integer
For I = 0 To 9
A(I) = 30 - I
Next
Randomize
For I = 1 To 20
Debug.Print A(10 * Rnd()) 'Print a random entry
Next
Every so often it'll round up and go boom with Subscript Out Of Range.
Clearly I meant:
Code:
Debug.Print A(Fix(10 * Rnd())) 'Print a random entry