Annotated SICP
- Structure and Interpretation of Computer Programs
- Front Matter
- 1 Building Abstractions with Procedures
- 2 Building Abstractions with Data
- 3 Modularity, Objects, and State
- 4 Metalinguistic Abstraction
- 5 Computing with Register Machines
- References
- List of Exercises

supermanhelp.com
ALGORITHM Newton
REAL :: Input, X, NewX, Tolerance
INTEGER :: Count
READ(*,*) Input, Tolerance
Count = 0 ! count starts with 0
X = Input ! X starts with the input value
DO ! for each iteration
Count = Count + 1 ! increase the iteration count
NewX = 0.5*(ans + Input/X) ! compute a new approximation
IF (ABS(X - NewX) < Tolerance) EXIT ! if they are very close, exit
X = NewX ! otherwise, keep the new one
END DO
WRITE(*,*) ‘After ‘, Count, ’ iterations:’
WRITE(*,*) ’ The estimated square root is ‘, NewX
WRITE(*,*) ’ The square root from SQRT() is ‘, SQRT(Input)
WRITE(*,*) ’ Absolute error = ‘, ABS(SQRT(Input) - NewX)
END PROGRAM SquareRoot
http://supermanhelp.com