Paul Hutchinson wrote: > Is the variable beta defined as an integer? If yes then: Yes. > In most, if not all, Basic dialects the variable beta will be used to > hold the intermediate results during calculation. (256 * (3 + beta) + > 2) fits into an integer but the next * 256 overflows an integer sized > variable. That happens. > I believe the Val(256) function call is returning a variant that is > used for the remaining intermediate calculations avoiding the > overflow condition. While this works I don't think VB guarantees this > method to work so, I recommend you define beta as a long instead of > an integer. Alternatively you can copy beta to a long and use the > long in the calculation. I have forced the value "256" to a long and works. Thank you, Paul. Dennis Crawley Argentina ;) PS: I'm aware there are more sites, but I like this. BTW I'm making a program which returns a precise delay loop code, based on Andy Warren basic algorithm. It will be shared freely here. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist