## What's the largest possible double number?

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US

### What's the largest possible double number?

For any grievances posted above, I blame whoever is in charge . . .

Mac
Veteran
Posts: 151
Joined: Mon Aug 06, 2007 2:00 pm

### Re: What's the largest possible double number?

K# DOUBLE
double-precision 64-bit floating-point
Sixteen place accuracy, Max = 1.797693134862315D+308

Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US

### Re: What's the largest possible double number?

Mac wrote:

K# DOUBLE
double-precision 64-bit floating-point
Sixteen place accuracy, Max = 1.797693134862315D+308
But what does the e+308 mean? I don't want precision, I just want a max number.
For any grievances posted above, I blame whoever is in charge . . .

BDZ
Coder
Posts: 49
Joined: Sun Nov 20, 2005 5:41 pm
Location: Wisconsin
Contact:

### Re: What's the largest possible double number?

Mentat wrote: But what does the e+308 mean? I don't want precision, I just want a max number.
"d+308" means "times 10 raised to the 308th power."

Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US
Oh. Well, could a number such as 400 and 6 be Double without truncating or any other problems? I'm asking this becuase I'm having a very wierd bug. It's as if the numbers are being "squashed" as soon as they're declared, and I'm using Doubles. Either that, or being "exploded."
For any grievances posted above, I blame whoever is in charge . . .

Mac
Veteran
Posts: 151
Joined: Mon Aug 06, 2007 2:00 pm

### Re: What's the largest possible double number?

BDZ wrote:
Mentat wrote:"d+308" means "times 10 raised to the 308th power."
Right. The letter "d" is used to designate you need double precision to hold this number. It otherwise the same as "e", meaning "exponent".

The problem with representing the number that way is that it implies that more accuracy is known than is.

Example:

1.24e4 means more than 1.24 * 10^4 which is 12400.

It means "A number between 12350 and 12450.

And in Physics is used a lot to indicate the accuracy known.

But in computing, it has lost the accuracy connotion, but instead simply means how the number is stored.

1.24e4 is stored as something like (4)(1240....0) where .... is the amount of significance that can be stored.

Mac

Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US
Yes, but could it be a bug for numbers such as 12 and 368? I'm getting ridiculus numbers such as 1.788...E-307 . All of them. Just after I initalize them to equal numbers like 540.
For any grievances posted above, I blame whoever is in charge . . .

burger2227
Veteran
Posts: 2460
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA
Mac is trying to tell you that some numbers such as 120 / 1500 will be
represented as an exponent of the number in some cases. This is called
scientific notation for an infinite or very long number, which no Qbasic
program can do.

To print the number to the screen in real terms, use PRINT USING and
only use the digits that you need for accuracy. Really long decimal place
numbers are really kind of stupid to use as they can be rounded off
simply!

PRINT USING " ######.##########", 120/1500

It will not change the real number and can be used in any calculation you need.
Use some kind of rounding method to change the actual number.
Once you get the number from PRINT USING, you can then round it off
with multiplication and division to the accuracy you need in a program.

When a double number is used in a calculation, it will tend to do that when
the actual value is between two values. I made a program once that
would change 11 to 11.001 somehow. Double is kinda funky!

Ted