Base Choice for Wordstream: - Most machines today use 32-bi words, as they are the most efficient for 32-bit processors. A single word integer, then, typically ranges from -2^31 to 2^31-1. The lack of symmetry in this range is thrown of by zero, which has to be either treated as positive or negative. This range convention is called 2's complement. You can read more about this on the web. The old (and mostly obsolete) range convention uses -(2^31-1) to 2^31-1, and is called 1's complement. The point here was the a change from the number a --> -a just requires a flip of bits. - In MzScheme, a fixnum is 30 bits plus a sign bit. The 32nd bit is mostly like used up in some computational overhead. The range used here, then, is probably -2^30 to 2^30-1, though the documentation doesn't specify. Therefore, for wordstream, a reasonable base to try is 2^15, which would involve wits (wordstream digits) -2^15-1 to 2^15-1 since both addition/multiplication of these wits would result in digits that still fit into the 30 bit word. An Example of a Timetest: - Here is an example of an timetest for an xreal implementation: (define (repeatop n) (and ((= n 0) empty) (else (let ((x (SOME OPERATION))) (repeatop (- n 1)) ) ) ) ) Given SOME OPERATION, this function will repeat it n times, allowing you to better notice relative changes in inefficiency. You will also want to use some operations that result in single precision and compare with those that require double precision. This also provides a method to precisely determine the single precision boundary. Inefficiencies in Exact Real Implementations: - Inefficiencies in precfunc to look for: 1) The generation of rational interval values that have very large numerator and denominator, when there is a much simpler rational in the interval to use. 2) Repeated computation of the same operation. - Inefficiencies in wordstream to look for: 1) (for small bases) full-word machine operation used to determine only a couple bits. (This should be a pretty huge time waster.) 2) (for large bases) a very high granularity of precision Implementing LISP "eval" Operation in Scheme: - See the DEMO for definitions - lookup: finds the value of a variable given an environment. For the null environment, it just returns the symbol (this isn't Scheme-ly correct) - eval_lambda_expr: takes lambda expression in an environment and returns the value of that expression in that environment. - If it gets and atom, it calls lookup on it. - If it gets 'lambda, leave it alone since it needs something to apply it to first. - Otherwise, process the elements of the expression as follows: If the expression is of the form: ((lambda (x) b) arg), then - Let fn = car(expr) = (lambda (x) b), and recursively call the eval_lambda_expr on it. - Let arg = car(expr) = arg, and recursively call eval_lambda_expr on it. - The rest of the expresion elts are isolated as follows: lambda = car(fn) (x) = cadr(fn) x = caadr(fn) b = caddr(fn) - The function then adds the evaluation of x to arg on to the environment. - In the DEMO, an error is demonstrated. Study the code and try to figure out the problem.