E within a number/at end (not Hex)

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

Post Reply
ozthor
Newbie
Posts: 5
Joined: Fri May 22, 2009 12:40 am

E within a number/at end (not Hex)

Post by ozthor » Fri May 22, 2009 12:47 am

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....

jasbales
Coder
Posts: 17
Joined: Mon Nov 22, 2004 11:36 am
Location: Prescott AZ
Contact:

Post by jasbales » Fri May 22, 2009 1:08 am

I still don't know that much QB and know less about Blitz, but I just read about numbers in QB a couple of days ago. If I'm reading that number right, it's a SINGLE with a value of 1.496 times 10 to the 8th power. How you'd represent that number in Blitz, I haven't a clue.

jasbales
Coder
Posts: 17
Joined: Mon Nov 22, 2004 11:36 am
Location: Prescott AZ
Contact:

Post by jasbales » Fri May 22, 2009 1:11 am

Oh yeah, the 'E' in your number just identifies it as a SINGLE.

ozthor
Newbie
Posts: 5
Joined: Fri May 22, 2009 12:40 am

Post by ozthor » Fri May 22, 2009 1:25 am

thanks jasbales....

thought it was to do with the size of the number... how many sapces to move the point.....

I just need to understand the value of the number...
working with it in blitz will be ok.... just getting it there in the right format

MystikShadows
Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:

Post by MystikShadows » Fri May 22, 2009 6:13 pm

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. :)
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

User avatar
burger2227
Veteran
Posts: 2344
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 » Fri May 22, 2009 6:35 pm

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

moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Post by moneo » Fri May 22, 2009 7:33 pm

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
If you are ahead of me, lead.
If you are behind me, follow.
If you are not doing anything,
Get out of the way.

User avatar
burger2227
Veteran
Posts: 2344
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 » Fri May 22, 2009 8:06 pm

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:

Code: Select all

CLS

a# = 1.496E+08

PRINT a#

PRINT USING "#########.##"; a#
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.
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

moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Post by moneo » Fri May 22, 2009 8:47 pm

Gee Ted, I've been wondering why you hadn't made some unkind remarks to me in quite some time. It's nice to see that you're back to your old self again.

Regards..... Moneo

MystikShadows
Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:

Post by MystikShadows » Fri May 22, 2009 9:09 pm

burger2227 wrote: STICK TO YOUR WEIRD ROUNDING IDEAS........ they make even less sense.
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.

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

User avatar
burger2227
Veteran
Posts: 2344
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 » Fri May 22, 2009 10:22 pm

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. :P

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

iamdenteddisk
Veteran
Posts: 185
Joined: Mon Jun 30, 2008 4:10 pm

EXPONENTATION

Post by iamdenteddisk » Sun May 24, 2009 11:53 pm

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..

Post Reply