Welcome to Dream.In.Code
Click Here
Getting Help is Easy!

Join 118,887 Programmers for FREE! Ask your question and get quick answers from experts. There are 2,069 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Problem related to COBOL programming language

 
Reply to this topicStart new topic

Problem related to COBOL programming language

ketaki
post 28 Apr, 2008 - 04:08 AM
Post #1


New D.I.C Head

*
Joined: 12 Feb, 2008
Posts: 7

Sir,

In case of COBOL language, if we want to raise the power e.g. we need to find out 2 raise to power 2 is how much.......means square of 2,

We can use

COMPUTE C = 2 ** 2.

this will work and after execution of this statement C will contain 4.

but if I will raise the power by decimal number, it wont work....e.g.

COMPUTE C = 4 ** (0.5).

but after execution of this statement C should contain 2....... but I am getting error.......

Kindly help me

Ketaki
User is offlineProfile CardPM

Go to the top of the page


BenignDesign
post 28 Apr, 2008 - 09:28 AM
Post #2


Just a code monkey in a world full of jocks...

Group Icon
Joined: 28 Sep, 2007
Posts: 859



Thanked 2 times

Dream Kudos: 150
My Contributions


Alright. Rewrite that a little more clearly and I'll see what I can do for you.

I think I know what you're trying to do, but I'm not totally sure.

It might be best to modify the decimal exponent.

As in, the user enters X^0.5, modify the exponent so the output is X/2?

Same with X^0.25... modified to X/4, etc, etc

As in if exp<1, then Y=1/exp and Z=X/Y?

Is this making any sense at all?

This post has been edited by BenignDesign: 28 Apr, 2008 - 09:32 AM
User is offlineProfile CardPM

Go to the top of the page

ketaki
post 30 Apr, 2008 - 01:00 AM
Post #3


New D.I.C Head

*
Joined: 12 Feb, 2008
Posts: 7

Thank you Sir for your kind reply. May I send the code?

ketaki
User is offlineProfile CardPM

Go to the top of the page

BenignDesign
post 30 Apr, 2008 - 03:51 AM
Post #4


Just a code monkey in a world full of jocks...

Group Icon
Joined: 28 Sep, 2007
Posts: 859



Thanked 2 times

Dream Kudos: 150
My Contributions


Send it where? You can post it here if you'd like and I can take a look at it.

code.gif
User is offlineProfile CardPM

Go to the top of the page

djkitt
post 23 May, 2008 - 07:59 AM
Post #5


D.I.C Head

**
Joined: 22 May, 2008
Posts: 128



Thanked 13 times
My Contributions


What error are you receiving? Are you getting an error at compile time? Or are you not receiving 2 as the answer for the square root of 4?

COMPUTE C = (4 ** .5)

should result in C containing 2.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/13/08 03:15AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month