[unsafe-]fl{real,image}-part: fix contracts in docs and errors
Closes PR 14368
This commit is contained in:
parent
57fb95e0a8
commit
4d3baa3b7d
|
@ -121,10 +121,18 @@ integer.}
|
|||
|
||||
|
||||
@deftogether[(
|
||||
@defproc[(make-flrectangular [a flonum?] [b flonum?])
|
||||
(and/c complex? inexact? (not/c real?))]
|
||||
@defproc[(flreal-part [a (and/c complex? inexact? (not/c real?))]) flonum?]
|
||||
@defproc[(flimag-part [a (and/c complex? inexact? (not/c real?))]) flonum?]
|
||||
@defproc[(make-flrectangular [a flonum?] [b flonum?])
|
||||
(and/c complex?
|
||||
(lambda (c) (flonum? (real-part c)))
|
||||
(lambda (c) (flonum? (imag-part c))))]
|
||||
@defproc[(flreal-part [a (and/c complex?
|
||||
(lambda (c) (flonum? (real-part c)))
|
||||
(lambda (c) (flonum? (imag-part c))))])
|
||||
flonum?]
|
||||
@defproc[(flimag-part [a (and/c complex?
|
||||
(lambda (c) (flonum? (real-part c)))
|
||||
(lambda (c) (flonum? (imag-part c))))])
|
||||
flonum?]
|
||||
)]{
|
||||
|
||||
Like @racket[make-rectangular], @racket[real-part], and
|
||||
|
|
|
@ -156,12 +156,19 @@ For @tech{flonums}: Unchecked (potentially) versions of
|
|||
@racket[flsqrt], and @racket[flexpt]. Currently, some of these
|
||||
bindings are simply aliases for the corresponding safe bindings.}
|
||||
|
||||
|
||||
@deftogether[(
|
||||
@defproc[(unsafe-make-flrectangular [a flonum?] [b flonum?])
|
||||
(and/c complex? inexact? (not/c real?))]
|
||||
@defproc[(unsafe-flreal-part [a (and/c complex? inexact? (not/c real?))]) flonum?]
|
||||
@defproc[(unsafe-flimag-part [a (and/c complex? inexact? (not/c real?))]) flonum?]
|
||||
@defproc[(unsafe-make-flrectangular [a flonum?] [b flonum?])
|
||||
(and/c complex?
|
||||
(lambda (c) (flonum? (real-part c)))
|
||||
(lambda (c) (flonum? (imag-part c))))]
|
||||
@defproc[(unsafe-flreal-part [a (and/c complex?
|
||||
(lambda (c) (flonum? (real-part c)))
|
||||
(lambda (c) (flonum? (imag-part c))))])
|
||||
flonum?]
|
||||
@defproc[(unsafe-flimag-part [a (and/c complex?
|
||||
(lambda (c) (flonum? (real-part c)))
|
||||
(lambda (c) (flonum? (imag-part c))))])
|
||||
flonum?]
|
||||
)]{
|
||||
|
||||
For @tech{flonums}: Unchecked versions of @racket[make-flrectangular],
|
||||
|
|
|
@ -3722,7 +3722,11 @@ Scheme_Object *scheme_checked_flreal_part (int argc, Scheme_Object *argv[])
|
|||
|
||||
if (!SCHEME_COMPLEXP(o)
|
||||
|| !SCHEME_DBLP(((Scheme_Complex *)o)->r))
|
||||
scheme_wrong_contract("flreal-part", "(and/c complex? (lambda (c) (flonum? (real-part c))))", 0, argc, argv);
|
||||
scheme_wrong_contract("flreal-part",
|
||||
"(and/c complex?"
|
||||
/* */ " (lambda (c) (flonum? (real-part c)))"
|
||||
/* */ " (lambda (c) (flonum? (imag-part c))))",
|
||||
0, argc, argv);
|
||||
|
||||
return _scheme_complex_real_part(o);
|
||||
}
|
||||
|
@ -3733,7 +3737,11 @@ Scheme_Object *scheme_checked_flimag_part (int argc, Scheme_Object *argv[])
|
|||
|
||||
if (!SCHEME_COMPLEXP(o)
|
||||
|| !SCHEME_DBLP(((Scheme_Complex *)o)->r))
|
||||
scheme_wrong_contract("flimag-part", "(and/c complex? (lambda (c) (flonum? (real-part c))))", 0, argc, argv);
|
||||
scheme_wrong_contract("flimag-part",
|
||||
"(and/c complex?"
|
||||
/* */ " (lambda (c) (flonum? (real-part c)))"
|
||||
/* */ " (lambda (c) (flonum? (imag-part c))))",
|
||||
0, argc, argv);
|
||||
|
||||
return scheme_complex_imaginary_part(o);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user