|
-
May 29th, 2000, 07:33 PM
#1
Thread Starter
New Member
why for exemple is 139 multiplied by 256 issue an overflow while 143 multiplied by 65536 doesn't.
-
May 29th, 2000, 07:58 PM
#2
Frenzied Member
I think everyone stumbles across this sooner or later.
it's because VB assumes 256 and 139 are integers and therefore can only be up to 32,767.
if you force one to be a long it's OK
eg. 139 * clng(256)
Maybe VB is actually trying to optimise!
-
May 30th, 2000, 06:41 AM
#3
Thread Starter
New Member
overflow
-
May 30th, 2000, 08:13 AM
#4
Fanatic Member
Re: overflow
Keep you math in declared vars and constants so you know what types you're dealing with, numbers don't tell you enough
Paul Dwyer 
Network Engineer
Aussie In Tokyo
Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)
-
May 30th, 2000, 08:21 AM
#5
If you're dealing with really big numbers, you can declare it as Decimal or Currency
-
May 30th, 2000, 03:07 PM
#6
transcendental analytic
Hint and hint, here's the actiul hint:
Declare your values!
Code:
?256&*256&
?65536@*65536@
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|