kent logo

CO538 Anonymous Questions and Answers Keyword Index

This page provides a keyword index to questions and answers. Clicking on a keyword will take you to a page containing all questions and answers for that keyword, grouped by year.

To submit a question, use the anonymous questions page. You may find the keyword index and/or top-level index useful for locating past questions and answers.

Keyword reference for demo.occ


Question 9 (2003):

In `demo.occ', why does the Fibonacci list produce negatives ? Is it to do with the maximum size a number can be ?

Answer 9:

The numbers in the Fibonacci sequence increase very rapidly, and soon exceed the capacity of a 32-bit INT, so integer overflow occurs. The results are then effectively meaningless, and are as likely to be negative as positive.

Unlike programming languages such as Java, occam normally checks for such errors - prefering to crash rather than give wrong answers. However, the component processes in demo.occ use explicitly unchecked arithmetic operators (PLUS, MINUS, TIMES), and not the usual checked ones (+, -, *). If they did not, the run of demo would be rather short!

Keywords: demo.occ , overflow

Valid CSS!

Valid XHTML 1.0!

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
Last modified Mon May 20 13:50:26 2013
This document is maintained by Fred Barnes, to whom any comments and corrections should be addressed.