Page 1 of 1

E within a number/at end (not Hex)

Posted: Fri May 22, 2009 12:47 am
by ozthor
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...


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

Posted: Fri May 22, 2009 1:08 am
by jasbales
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.

Posted: Fri May 22, 2009 1:11 am
by jasbales
Oh yeah, the 'E' in your number just identifies it as a SINGLE.

Posted: Fri May 22, 2009 1:25 am
by ozthor
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

Posted: Fri May 22, 2009 6:13 pm
by MystikShadows
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


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

Posted: Fri May 22, 2009 6:35 pm
by burger2227
It also surely moves the decimal point!

Posted: Fri May 22, 2009 7:33 pm
by moneo
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


print using "##########";n


Regards..... Moneo

Posted: Fri May 22, 2009 8:06 pm
by burger2227
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


a# = 1.496E+08


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.

Posted: Fri May 22, 2009 8:47 pm
by moneo
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

Posted: Fri May 22, 2009 9:09 pm
by MystikShadows
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.

Posted: Fri May 22, 2009 10:22 pm
by burger2227
Round up, round 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


PS: It is not personal Moneo, but why even attempt to answer that question?


Posted: Sun May 24, 2009 11:53 pm
by iamdenteddisk
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..