next up previous contents
Next: Signed Binary Division by Up: Design and Implementation Previous: Dyadic digit representation

Coding an algorithm in Haskell

  Chapter 4 describes the algorithms for the basic operations. Once we have developed and these algorithms, proving correctness and convergence, coding them in Haskell is a relatively straightforward procedure. The descriptions of the algorithms suggest obvious recursive definitions which are easily expressed in the functional language.

In order to illustrate the procedure we examine the implementation of two algorithms for performing division of a signed binary stream by an integer (section 4.3.3), and averaging two signed binary streams (section 4.3.1). The Haskell code used to implement the algorithms for division and the computation of limits of sequences described in sections 4.4.4 and 5.1 is given in appendix B.


Martin Escardo