Programming (C++)

Offtopic enough?

So I'm writing a program...or actually just wrote it, and managed to find out it's bugging out on me. C++, as the title says.

Long story short, it's generating a value that is too large to fit inside a Double. This is all well and good; it's generating, as far as I can tell, the value it's supposed to-I don't have the time at the moment to step through it until it hits that limit, or I would.

In any case, the simple fact of the matter is I'm performing mathematical operations and exceeding the upper limit of what a double can hold.

Any ideas?

-

Edit- may possibly (unlikely) be a false alarm-I'm actually expecting monstrous numbers, but in an attempt to narrow the problem down further and/or find a way around it, I've managed to discover my programs keep giving me values that should be out of range, even with ridiculously low limits so they shouldn't, and I've yet to determine why.
15,156 views 5 replies
Reply #1 Top
Can you post the code?
Reply #2 Top
I managed to figure it out-I was using a compiler I wasn't used to and just forgot to look somewhere I normally look.

I did manage to discover that at least at present I'm not exceeding the limitations of a double. I'm still curious if there's anything larger than a double that I can use for mathematical operations, though.
Reply #3 Top
http://en.wikipedia.org/wiki/Long_double
Reply #4 Top
I was under the impression a long double wasn't actually larger than a double, even with the extended precision, but I don't remember where I got that from. Initially it seemed to logically be the case that it was larger, but somewhere along the way some source managed to convince (and I use the term lightly) me otherwise. I've just never had a reason to use them, though, so I never bothered knowing. Serves me right, I guess.

Hopefully that will be large enough. If it isn't, well...I guess I've got problems. (As a note, I am fully aware of how large a double is, and now, more aware of how large a long double is. Knowing this, I still have concerns that I may be forced to use a long double as a double may not be of sufficient size, and, again, I hope the long double will be up to the task.)

My apologies for what seem to be very basic questions, particularly as in this instance I was hoping for something beyond a long double and didn't specify, which as far as I know turns it into a not-so-basic question. This does, however, give rise to the question of what in the world I'm doing that needs that much space to calculate something out (and store it, even). And the answer is, well, lots of things. I'm fairly positive the code isn't as horribly inefficient as one might assume from that much calculation space being necessary, either.

I do appreciate the fact that you guys have responded to this thread, though.