Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
yuvaraj_d
Warnings : 2

New User

Joined: 11 Dec 2006
Posts: 2
Location: bangalore

 Posted: Mon Dec 11, 2006 9:13 pm    Post subject: Need algorithm for the square root I'm looking for an algorithm for the square root.

dick scherrer

Site Director

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

Posted: Mon Dec 11, 2006 9:31 pm    Post subject:

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

Global Moderator

Joined: 27 Dec 2005
Posts: 2360
Location: Israel

 Posted: Tue Dec 12, 2006 4:14 am    Post subject: Have you tried to use Google for the keywords square root algorithm pseudocode? O.
William Thompson

Global Moderator

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

 Posted: Tue Dec 12, 2006 4:29 am    Post subject: 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?
mmwife

Super Moderator

Joined: 30 May 2003
Posts: 1592

 Posted: Wed Dec 13, 2006 9:47 am    Post subject: Why an algorithm? How about this: COMPUTE WS-SQRT = (WS-NBR ** .5) Don't forget to define WS-SQRT with decimal places.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

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

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us