check-= uses magnitude to compare number differences

original commit: 9f9468f7c2cd7c8618f3575d384dd63c9c60598e
This commit is contained in:
John Clements 2012-05-03 10:55:22 -07:00
parent 65ed1d1d82
commit 3d59b3de3c
2 changed files with 2 additions and 2 deletions

View File

@ -251,7 +251,7 @@
(equal? expr1 expr2)) (equal? expr1 expr2))
(define-simple-check (check-= expr1 expr2 epsilon) (define-simple-check (check-= expr1 expr2 epsilon)
(<= (abs (- expr1 expr2)) epsilon)) (<= (magnitude (- expr1 expr2)) epsilon))
(define-simple-check (check-true expr) (define-simple-check (check-true expr)
(eq? expr #t)) (eq? expr #t))

View File

@ -68,7 +68,7 @@ The following check fails:
@defproc[(check-= (v1 any) (v2 any) (epsilon number?) (message string? "")) @defproc[(check-= (v1 any) (v2 any) (epsilon number?) (message string? ""))
void?]{ void?]{
Checks that @racket[v1] and @racket[v2] are within Checks that @racket[v1] and @racket[v2] are numbers within
@racket[epsilon] of one another. The optional @racket[epsilon] of one another. The optional
@racket[message] is included in the output if the check @racket[message] is included in the output if the check
fails. fails.