next up previous contents
Next: Testing for equality Up: CHAPTER.5: NUMERICAL AND Previous: Additional mathematical functions

Exercises

1. What are the data types of each of the following?

    33
    33.0
    8:777
    "cat"
    'asdf;lkj876 *+*++ '
    [1 2 3 4]
    33 + sqrt(-5)
    123.45e3
    123.45s-3
How would the data types of the preceeding example change if popdprecision had the value false, "ddecimal" or true ?

3. What do the following expresions denote?

    33 + 3
    3 + 4 * 5
    (3 + 4) * 5
    6 - 3.0
    sign(random(20))
    1.5e5
    1.5e-5
    2:11111
If you have access to a computer running Pop-11 you can test your answers using `=>'. E.g.

    6 - 3.0 =>
What is the effect of the variable POPRADIANS?

5. What variable can be given the value 2 to make pop print numbers in binary notation?

6. What happens if that variable is given the value 1?

7. How can you make pop-11 print in hexadecimal form?

8. How would you represent the numbers 16, 21, 30, 35, 40

    (a) in binary form?
    (b) in hexadecimal form (i.e. 16:???????)?
Define a procedure which produces a random decimal between -1 and 1

10. Define a procedure which produces a random ratio between -10 and 10



Aaron Sloman
Fri Jan 2 03:17:44 GMT 1998