Skip to content

Commit

Permalink
real-vs-fp pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
bennn committed Aug 18, 2023
1 parent 024862d commit ab45dee
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
Binary file added fig/real_vs_fp.pdf
Binary file not shown.
33 changes: 19 additions & 14 deletions more_figures.rkt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#lang racket
(require plot)
(require plot/no-gui)

;; (define (floor-log n [base 10])
;; (floor (log n base)))
Expand All @@ -10,8 +10,12 @@
(set! last-val (+ last-val (expt stretch (floor (/ i subseq)))))
last-val))

(parameterize ([plot-width 1500]
[plot-height 100]
(define num-points 20)
(define point-sep 2)
(define out-kind 'pdf)

(parameterize ([plot-width 500]
[plot-height 80]
[plot-x-ticks (ticks-add (linear-ticks #:number 10) (range -50 50) #f)]
[plot-x-tick-labels? #f]
[plot-y-ticks no-ticks]
Expand All @@ -22,22 +26,23 @@
[plot-x-far-axis? #f]
[plot-background-alpha 0.0]
)
(define xs (append (map - (fp-example-points 20 4 1.52))
(define xs (append (map - (fp-example-points num-points point-sep 1.52))
(list 0)
(fp-example-points 20 4 1.52)))
(displayln (cons (apply min xs) (apply max xs)))
(plot
#:out-file "/Users/ashton/Research/writing/juliacon2023-paper/fig/real_vs_fp.png"
#:out-kind 'png
#:x-min -50
#:x-max 50
#:y-min 0
#:y-max 3
(fp-example-points num-points point-sep 1.52)))
#;(displayln (cons (apply min xs) (apply max xs)))
(plot-file
(list
(points (map (λ (x) (vector x 1)) xs)
#:sym 'fullcircle5
;; #:sym 'point
))))
))
(format "./fig/real_vs_fp.~a" out-kind)
out-kind
#:x-min -50
#:x-max 50
#:y-min 0
#:y-max 2
))

;; (require math/utils)
;; (test-floating-point 10000)

0 comments on commit ab45dee

Please sign in to comment.