Fixed error: attempt to divide by (void) when axis bounds' length is a multiple of 1000

Please merge into 5.2
This commit is contained in:
Neil Toronto 2011-10-10 13:26:30 -06:00
parent 90304687f1
commit a0e2401cbe
2 changed files with 5 additions and 3 deletions

View File

@ -29,9 +29,9 @@
(define e (floor-log10 (- x-max x-min))) (define e (floor-log10 (- x-max x-min)))
(define mag (expt 10 e)) (define mag (expt 10 e))
(define step (let ([y (/ (- x-max x-min) mag)]) (define step (let ([y (/ (- x-max x-min) mag)])
(cond [(y . < . 2) (* 1/5 mag)] (cond [(y . < . 2) (* 1/5 mag)]
[(y . < . 5) (* 1/2 mag)] [(y . < . 5) (* 1/2 mag)]
[(y . < . 10) mag]))) [else mag])))
(define start (* (ceiling (/ x-min step)) step)) (define start (* (ceiling (/ x-min step)) step))
(define stop (* (floor (/ x-max step)) step)) (define stop (* (floor (/ x-max step)) step))
(define num (+ 1 (round (/ (- stop start) step)))) (define num (+ 1 (round (/ (- stop start) step))))

View File

@ -11,6 +11,8 @@
(plot empty #:x-min -1 #:x-max 1 #:y-min -1 #:y-max 1) (plot empty #:x-min -1 #:x-max 1 #:y-min -1 #:y-max 1)
(time (plot (function values 0 1000)))
(parameterize ([plot-background "black"] (parameterize ([plot-background "black"]
[plot-foreground "white"] [plot-foreground "white"]
[plot-background-alpha 1/2] [plot-background-alpha 1/2]