E within a number/at end (not Hex)
E within a number/at end (not Hex)
A question about the way qbasic works with numbers...
I have the following number in and old qbasic program I'm trying to convert to a Blitz's Basic...
1.496E+08
what I want to know is just what this number is???
what affect the E has on the number???
the other basic will not read the number as it is so need to find another way to write it...
but first need to understand it.......
any help?? thanks....
I have the following number in and old qbasic program I'm trying to convert to a Blitz's Basic...
1.496E+08
what I want to know is just what this number is???
what affect the E has on the number???
the other basic will not read the number as it is so need to find another way to write it...
but first need to understand it.......
any help?? thanks....
-
- Veteran
- Posts: 703
- Joined: Sun Nov 14, 2004 7:36 am
- Contact:
1.496E+08 is called the scientific notation.
In this case it means that 1.496 * 10 ^ 8 which results in 149 600 000 million
The number after E can also be a negative number
1.496E-08
which would mean 0.00000001496
Basically instead of displaying all the decimals like this they chose the 1.496 E+08
originally your first idea was closer.
Hope this helps.
In this case it means that 1.496 * 10 ^ 8 which results in 149 600 000 million
The number after E can also be a negative number
1.496E-08
which would mean 0.00000001496
Basically instead of displaying all the decimals like this they chose the 1.496 E+08
originally your first idea was closer.
Hope this helps.
When God created light, so too was born, the first Shadow!
MystikShadows
Need hosting? http://www.jc-hosting.net
Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
MystikShadows
Need hosting? http://www.jc-hosting.net
Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
It also surely moves the decimal point!
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
Your number of 1.496E+E08 is equal to 149600000.
It's too big to fit into an integer variable.
To be expressed as a single variable, it it needs to be converted to the format you have with E+08. Sorry, but I don't have the reason for this.
It fits fine into a long variable and a double variabe, and will show as 149600000.
To convert a number containing the E or D exponents is quite a complicated little program of about 240 lines of code. Mac, from the QBasic forum, wrote such a program. The problem is mostly of validation of the given input number, in addition to determining which variable types the result can be successfully expressed as.
If you just have a handful of these numbers to convert, you can use the following litttle program as an example:
dim n as single
n=1.496E+08
print using "##########";n
system
Regards..... Moneo
It's too big to fit into an integer variable.
To be expressed as a single variable, it it needs to be converted to the format you have with E+08. Sorry, but I don't have the reason for this.
It fits fine into a long variable and a double variabe, and will show as 149600000.
To convert a number containing the E or D exponents is quite a complicated little program of about 240 lines of code. Mac, from the QBasic forum, wrote such a program. The problem is mostly of validation of the given input number, in addition to determining which variable types the result can be successfully expressed as.
If you just have a handful of these numbers to convert, you can use the following litttle program as an example:
dim n as single
n=1.496E+08
print using "##########";n
system
Regards..... Moneo
If you are ahead of me, lead.
If you are behind me, follow.
If you are not doing anything,
Get out of the way.
If you are behind me, follow.
If you are not doing anything,
Get out of the way.
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
Why don't you have the answer? Because you NEVER use the IDE! LONG is for INTEGERS! NOT decimal point numbers.........
So why say anything at all? Myst handled the question just fine! You sound like a parrot without any crackers.
STICK TO YOUR WEIRD ROUNDING IDEAS........ they make even less sense.
LOL @ 240 lines! What is the problem really? I can print the number easily using a double variable:
If you want to get rid of scientific notation, try PRINT USING. You may have to decrease the number of decimal point digit markers to eliminate the D or E notation in some values. PRINT USING does NOT change the actual number value in the program, but looks normal to regular folks.
So why say anything at all? Myst handled the question just fine! You sound like a parrot without any crackers.
STICK TO YOUR WEIRD ROUNDING IDEAS........ they make even less sense.
LOL @ 240 lines! What is the problem really? I can print the number easily using a double variable:
Code: Select all
CLS
a# = 1.496E+08
PRINT a#
PRINT USING "#########.##"; a#
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
-
- Veteran
- Posts: 703
- Joined: Sun Nov 14, 2004 7:36 am
- Contact:
Moneo's rounding ideas are far from weird. They should be read and understood by anyone serious about programming in the business world or anywhere else good accuracy is needed. still today they apply. I've come to respect what moneo has to say and welcome his input on questions such as these.burger2227 wrote: STICK TO YOUR WEIRD ROUNDING IDEAS........ they make even less sense.
I also think that the more answers the original poster gets, the more point of views he has, and then he can pick and choose the method he is comfortable with.
When God created light, so too was born, the first Shadow!
MystikShadows
Need hosting? http://www.jc-hosting.net
Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
MystikShadows
Need hosting? http://www.jc-hosting.net
Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
Round up, round down...........it is not a big deal. Use what you think you need like you said. Moneo liked to round down loan payments and round up the interest. I think he owns a bank, LOL.
I just recall something that somebody had posted for over 5 years in the Tricks Forum. Moneo said it was wrong because it should have added .5 to the value or something. They did not post it for a specific idea or program!
I spent over a week trying to explain the difference between Single and Double values. Even Mac got involved.
Ted
PS: It is not personal Moneo, but why even attempt to answer that question?
I just recall something that somebody had posted for over 5 years in the Tricks Forum. Moneo said it was wrong because it should have added .5 to the value or something. They did not post it for a specific idea or program!
I spent over a week trying to explain the difference between Single and Double values. Even Mac got involved.
Ted
PS: It is not personal Moneo, but why even attempt to answer that question?
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
-
- Veteran
- Posts: 185
- Joined: Mon Jun 30, 2008 4:10 pm
EXPONENTATION
mathmatic terminology
for the +E or -E is exponentation, meaning to the positive or negitive powers of which is explained above in laymen's terms
if a number is 4+E03 then it has 3 zeros after it 4000 and it is "for moving the decimal"
I sugest exactly that for shrinking the number then bloating it back to size after if that is the need.
terminology is important..
as in the (x,y) you see so much of in graphics are called the "Absisa and ordinate" and only when used in a group of sets are they considered co-ordinates.else are called by name or refered to as a "set" - Usefull info if ever needed just remember it for later..
for the +E or -E is exponentation, meaning to the positive or negitive powers of which is explained above in laymen's terms
if a number is 4+E03 then it has 3 zeros after it 4000 and it is "for moving the decimal"
I sugest exactly that for shrinking the number then bloating it back to size after if that is the need.
terminology is important..
as in the (x,y) you see so much of in graphics are called the "Absisa and ordinate" and only when used in a group of sets are they considered co-ordinates.else are called by name or refered to as a "set" - Usefull info if ever needed just remember it for later..