There is a long standing issue, still present in PBWin10/CC6, with how the compiler interprets a QUAD literal that has 19 decimal digits. It only uses the first 18 when building the QUAD value.
Examples illustrating the problem
Code:
 ? DEC$(1111111111111111111,19) ' returns 1111111111111111110
 ? HEX$(1000000000000000009,16) ' returns 0DE0B6B3A7640000
 ? HEX$(1000000000000000010,16) ' returns 0DE0B6B3A764000A
One work-round is to round down the value and add the last digit separately
Code:
? DEC$(1111111111111111110 + 1,19) ' returns 1111111111111111111
? HEX$(1000000000000000000 + 9,16) ' returns 0DE0B6B3A7640009