check-= uses magnitude to compare number differences
original commit: 9f9468f7c2cd7c8618f3575d384dd63c9c60598e
This commit is contained in:
parent
65ed1d1d82
commit
3d59b3de3c
|
@ -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))
|
||||||
|
|
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user