Main
   Home
   About
   DiscussionBoard
Files
   About
   Submit
   Search
Downloads
   Action
   QB64
Links
   Link to us
QB45.org
[ Back to QB45 | FAQ | Search a message | Reply to this message | Back to messages ]

Saswata on 08/09/13 - 05:55:23

<DEFINT A-Z
CLS
A$ = "f"
A = ASC(A$)
N = A ^ 4 - 600 * 23
PRINT N
END>

If I put DEFLNG instead of DEFINT, N returns a different value. Why?

Todd on 08/09/13 - 08:02:38

DEFLNG defines "longs" while DEFINT defines "integers". Integers in QB64 are 2-bytes meaning that they can store the values between -32768 and 32767. Longs are 4-bytes and store -2147483648 to 2147483647.

Your expression "A ^ 4" computes to roughly 108243216, which causes an overflow if A is an integer. If it's a long, it will evaluate to its correct value.

Hope this helps!

Reply to this message
Name:
Message:
Please enter this number:
No HTML allowed. You may use BB-code in your posting.
Members
Login
Register
QB45 Members
Member List