Blame


1 12687dd9 2023-08-04 jrmu ;; The first three lines of this file were inserted by DrScheme. They record metadata
2 12687dd9 2023-08-04 jrmu ;; about the language level of this file in a form that our tools can easily process.
3 12687dd9 2023-08-04 jrmu #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 12687dd9 2023-08-04 jrmu (define-struct inex (mantissa sign exponent))
5 12687dd9 2023-08-04 jrmu
6 12687dd9 2023-08-04 jrmu An inexact number (inex) is a structure
7 12687dd9 2023-08-04 jrmu (make-inex m s e)
8 12687dd9 2023-08-04 jrmu where m, e are N in the interval [0,99] and s is either +1 or -1.
9 12687dd9 2023-08-04 jrmu
10 12687dd9 2023-08-04 jrmu create-inex : N N N -> inex
11 12687dd9 2023-08-04 jrmu Creates an inex from mantissa, sign, and exponent.
12 12687dd9 2023-08-04 jrmu
13 12687dd9 2023-08-04 jrmu (define (create-inex mantissa sign exponent)
14 12687dd9 2023-08-04 jrmu (cond
15 12687dd9 2023-08-04 jrmu [(and (<= 0 m 99)
16 12687dd9 2023-08-04 jrmu (<= 0 e 99)
17 12687dd9 2023-08-04 jrmu (= (abs s) 1)) (make-inex m s e)]
18 12687dd9 2023-08-04 jrmu [else (error 'create-inex "(<= 0 m 99), +1 or -1, (<= 0 e 99) expected")]))