Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Need algorithm for the square root

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
yuvaraj_d
Warnings : 2

New User


Joined: 11 Dec 2006
Posts: 2
Location: bangalore

PostPosted: Mon Dec 11, 2006 9:13 pm    Post subject: Need algorithm for the square root
Reply with quote

I'm looking for an algorithm for the square root.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Dec 11, 2006 9:31 pm    Post subject:
Reply with quote

Hello,

If you're coding in COBOL, there is a SQRT (square root) funtion.

From the IBM COBOL manual. . . .
Quote:
The SQRT function returns a numeric value that approximates the square root of the argument specified. The function type is numeric.

FUNCTION SQRT ( argument-1 )
argument-1 Must be class numeric. The value of argument-1 must be zero or positive. The returned value is the absolute value of the approximation of the square root of argument-1.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Tue Dec 12, 2006 4:14 am    Post subject:
Reply with quote

Have you tried to use Google for the keywords square root algorithm pseudocode?

O.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Tue Dec 12, 2006 4:29 am    Post subject:
Reply with quote

As far as algorithns go, long division is just guess a multiplier and subtract to see if it was too high or too low...grin...

I'd imagine that guess a root and subtract could be used also?
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Dec 13, 2006 9:47 am    Post subject:
Reply with quote

Why an algorithm? How about this:

COMPUTE WS-SQRT = (WS-NBR ** .5)

Don't forget to define WS-SQRT with decimal places.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Root Segments order kris_madras IMS DB/DC 2 Thu Mar 14, 2013 4:12 pm
No new posts Byte conversion Algorithm seahawk789 COBOL Programming 6 Tue Dec 11, 2012 12:09 am
No new posts Algorithm to unpack ISPF PACKED format Robert Robinson TSO/ISPF 21 Tue Oct 23, 2012 9:43 pm
No new posts Expanding only root segments from len... don.leahy IMS DB/DC 11 Wed Sep 12, 2012 6:00 pm
No new posts COBOL match file algorithm Deepthy Jose P COBOL Programming 7 Sat Jul 16, 2011 10:25 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us