Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

0.E0 ??? 1

Status
Not open for further replies.

TJ73

Programmer
Nov 14, 2023
8
US
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.
 
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.
 
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.
 
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.)
 
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
 
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.
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top