Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

data type help

hi, i was wondering why i keep on getting the overflow error.. is it because my values are beyond the range? i was using double type. if so, how can i increase the memory (if i have to) of the double data type.. or do i have to use another data type..
[251 byte] By [holyknight] at [2007-11-11 8:04:14]
# 1 Re: data type help
Hi,

first of all I don't know wich code you are using. If you are using for example a counter as double and you don't need decimal places, you can best use long.

If you post a sample code with a little explanation what you are doing, it would be easier to help.

Benjamin
Benjamin at 2007-11-11 17:25:59 >
# 2 Re: data type help
Typically an overflow is caused when the values exceed a range. There are some quirks to be aware off when dealing with numbers though... VB (and any other langauge) doesn't always do things the way you think it should.

Post the offending code and we can take a look.
edburdo at 2007-11-11 17:27:01 >
# 3 Re: data type help
well.. the code is actually pretty long.. to make it short.. its actually a computation of the bairstow method. its an iteration in numerical methods.
the values could go up very very big or very very small..

i definitely need a double data type. but that is the main problem, double aint enough. i always get the overflow error.

is there any way i could get a data type that can support numbers larger than double? or..
double is 8 bits right? can i increase that memory? and if i do, will that increase the data capacity?

sorry if cant fill the code.. its kinda long (very long)

thanx :) :)
holyknight at 2007-11-11 17:28:11 >
# 4 Re: data type help
double is 64 bits.. you can store a **** of data there!
run your code in the IDE, that will stop showing the line with the overflow error. You can then easily find what is causing the overflow...

Marco
mstraf at 2007-11-11 17:29:04 >
# 5 Re: data type help
wel.. yea.. the error was my numbers was exceeding double.. anyway, i guess il just have to handle the error and stick with double.. thnx guys
holyknight at 2007-11-11 17:30:11 >
# 6 Re: data type help
If you google, you can find methods to manipulate Really Big (tm) numbers. :)

I know Planet Source Code has some good code samples of doing big math.
edburdo at 2007-11-11 17:31:10 >