summaryrefslogtreecommitdiff
path: root/coding-exercises/2/10.rkt
blob: ae687811f9d7420e310105aad0105b56fdc89ad9 (plain)
1
2
3
4
5
6
7
8
9
10
11
#lang racket
(require "../../shared/intervals.rkt")

(define (div-interval x y)
  (if (and (< 0 (lower-bound y)) (> 0 (upper-bound y)))
    (error "Division by interval spanning zero")
    (mul-interval 
      x
      (make-interval 
        (/ 1.0 (upper-bound y))
        (/ 1.0 (lower-bound y))))))