Browse files

Started racket version

  • Loading branch information...
pavpanchekha committed Oct 25, 2013
1 parent 0680216 commit 7c2844a06e32a96d68b0898d4a27c5b2dc9a7783
Showing with 19 additions and 0 deletions.
  1. +19 −0 casio.rkt
@@ -0,0 +1,19 @@
#lang racket
(require racket/match)
(require racket/flonum)
(define prog1 '(/ (- (exp x) 1.0d0) x))
(define (error/one var prog val)
(let* [(fn (eval `(lambda (,var) ,prog)))
(double-val (fn (real->double-flonum val)))
(single-val (fn (real->single-flonum val)))]
(flabs (fl/ (fl- double-val single-val) double-val))))
(define (random-flonum)
(expt 2 (- (* 253 (random)) 126)))
(define (error var prog)
(filter (lambda (x) (not (or (infinite? x) (nan? x))))
(build-list 100 (lambda (x) (error/one var prog (random-flonum))))))

0 comments on commit 7c2844a

Please sign in to comment.