What's the largest possible double number?
What's the largest possible double number?
Please don't use e.
For any grievances posted above, I blame whoever is in charge . . .
Re: What's the largest possible double number?
How about "d"?Mentat wrote:Please don't use e.
K# DOUBLE
double-precision 64-bit floating-point
Sixteen place accuracy, Max = 1.797693134862315D+308
Re: What's the largest possible double number?
But what does the e+308 mean? I don't want precision, I just want a max number.Mac wrote:How about "d"?Mentat wrote:Please don't use e.
K# DOUBLE
double-precision 64-bit floating-point
Sixteen place accuracy, Max = 1.797693134862315D+308
For any grievances posted above, I blame whoever is in charge . . .
Re: What's the largest possible double number?
"d+308" means "times 10 raised to the 308th power."Mentat wrote: But what does the e+308 mean? I don't want precision, I just want a max number.
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 . . .
Re: What's the largest possible double number?
Right. The letter "d" is used to designate you need double precision to hold this number. It otherwise the same as "e", meaning "exponent".BDZ wrote:Mentat wrote:"d+308" means "times 10 raised to the 308th power."
To directly answer your question: 179769313486231500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Does that help you out?
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
- burger2227
- Veteran
- Posts: 2466
- 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
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
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Just like to point out, this isn't necessarily a QB error, it's just because doubles don't have infinite space to store the number, so it has to approximate. This is one of the first concepts you need to learn to do "real" programming. Don't ever compare two floating point numbers, do like (abs(num1 - num2) < .0001), or some other suitable range.