×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

0.E0 ???

0.E0 ???

(OP)
Hmmm . . .
Recently encountered COMPUTE A = ((B + C) * D) * ((E / F) - G) + 0.E0
What is the significance/purpose/benefit of 0.E0 ?

In advance - thanks.

RE: 0.E0 ???

I asked Bing:

In COBOL, 0.E0 is a numeric literal that represents the value of 0.0 in scientific notation 1. Scientific notation is a way of expressing numbers that are too large or too small to be conveniently written in decimal form. It is commonly used in scientific and engineering calculations. The letter E in 0.E0 stands for exponent. In this case, the exponent is 0, which means that the value of 0.E0 is equal to 0 multiplied by 10 to the power of 0, which is 1 1.

RE: 0.E0 ???

Isnt 0.E0 equal to 0?

RE: 0.E0 ???

I assume it's historical, platform and data type specific. Somewhere at some point there was a problem with the calculation with COMPUTE. Someone made the following workaround and then it became commonly used by the programmers there. See for example this:
https://stackoverflow.com/questions/8512009/cobol-...

RE: 0.E0 ???

(OP)
. . . which is 1 1 ???

RE: 0.E0 ???

Quote (TJ73)


. . . which is 1 1 ???
don't know what you mean ...

RE: 0.E0 ???

(OP)
See SaltyTheFrog's initial reply above. I was following along quite nicely, thinking the end result would be zero, because anything times zero is zero, but that particular reply ended with . . . ", which is 1 1."

RE: 0.E0 ???

of course it's a typo since 0.E0 = 0

RE: 0.E0 ???

Just a guess here as I haven't used Cobol for 40+ years, but is it just trying to force the whole calculation to be carried out using engineering format so that it can handle a mixture of very large and very small numbers. (By very small I mean 0.000000000009 not 999999999999.999.)

RE: 0.E0 ???

The confusion is probably in the E. E just means times 10 to the power of - same as in any calculator. ** means to the power of

CODE

* 0 times 10 to the power of 0 i.e 0 x 10 ** 0 = 0 x 1 = 0
COMPUTE E = 0.0E0
COMPUTE POW = 0 ** 0
DISPLAY "E is " E.
DISPLAY "POW is " POW. 

This will display

CODE

E is   0
POW is   1 

RE: 0.E0 ???

To xwb.
I don't think that he was asking what it was, rather what the purpose of it was. i.e. why is it there.

RE: 0.E0 ???

(OP)
Actually - XWB's commentary is appreciated. Overall, the exchange is good. Thank you. 0.E0, being a scientific notation-kind of thing, is something I'd expect to see in FORTRAN (if its syntax is good), with that FORTRAN program called for it's computational value. Embedding within COBOL, I think, is a very infrequent kind-of-thing. Hence my initial surprise. It's certainly not something I've seen over the past 40 years. Notwithstanding - again - thank you all! Kind regards.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close