New functions scm_is_exact and scm_is_inexact

* doc/ref/api-data.texi (Exact and Inexact Numbers): doc for scm_is_exact
  and scm_is_inexact
* libguile/numbers.c (scm_is_exact, scm_is_inexact): new functions
* libguile/numbers.h: declarations for scm_is_exact and scm_is_inexact
* test/suite/standalone/test-conversion.c (test_is_exact, test_is_inexact):
  new tests
This commit is contained in:
Mike Gran 2011-10-09 20:54:37 -07:00
commit 022dda6901
4 changed files with 58 additions and 0 deletions

View file

@ -747,12 +747,25 @@ otherwise.
@end deffn
@deftypefn {C Function} int scm_is_exact (SCM z)
Return a @code{1} if the number @var{z} is exact, and @code{0}
otherwise. This is equivalent to @code{scm_is_true (scm_exact_p (z))}.
An alternate approch to testing the exactness of a number is to
use @code{scm_is_signed_integer} or @code{scm_is_unsigned_integer}.
@end deftypefn
@deffn {Scheme Procedure} inexact? z
@deffnx {C Function} scm_inexact_p (z)
Return @code{#t} if the number @var{z} is inexact, @code{#f}
else.
@end deffn
@deftypefn {C Function} int scm_is_inexact (SCM z)
Return a @code{1} if the number @var{z} is inexact, and @code{0}
otherwise. This is equivalent to @code{scm_is_true (scm_inexact_p (z))}.
@end deftypefn
@deffn {Scheme Procedure} inexact->exact z
@deffnx {C Function} scm_inexact_to_exact (z)
Return an exact number that is numerically closest to @var{z}, when