Blob


1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
2 ;; about the language level of this file in a form that our tools can easily process.
3 #reader(lib "htdp-advanced-reader.ss" "lang")((modname |33.1|) (read-case-sensitive #t) (teachpacks ((lib "draw.ss" "teachpack" "htdp") (lib "arrow.ss" "teachpack" "htdp") (lib "gui.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #t #t none #f ((lib "draw.ss" "teachpack" "htdp") (lib "arrow.ss" "teachpack" "htdp") (lib "gui.ss" "teachpack" "htdp")))))
4 (define-struct inex (mantissa sign exponent))
6 An inexact number (inex) is a structure
7 (make-inex m s e)
8 where m, e are N in the interval [0,99] and s is either +1 or -1.
10 create-inex : N N N -> inex
11 Creates an inex from mantissa, sign, and exponent.
13 (define (create-inex mantissa sign exponent)
14 (cond
15 [(and (<= 0 m 99)
16 (<= 0 e 99)
17 (= (abs s) 1)) (make-inex m s e)]
18 [else (error 'create-inex "(<= 0 m 99), +1 or -1, (<= 0 e 99) expected")]))