diff options
author | Mark H Weaver <mhw@netris.org> | 2011-01-26 09:34:02 -0500 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-01-28 12:21:14 +0100 |
commit | 7112615f73bf79197832fd044dc7f7d9d94b5325 (patch) | |
tree | a3018e7ef176829db77b1ee2988160609d9a58e9 /doc/ref/api-data.texi | |
parent | cff5fa3384a097839e4a7ae74307d55bab58e2ba (diff) | |
download | guile-7112615f73bf79197832fd044dc7f7d9d94b5325.tar.gz |
Implement `finite?' in core and fix R6RS `finite?' and `infinite?'
* libguile/numbers.c (scm_finite_p): Add new predicate `finite?' from
R6RS to guile core, which returns #t if and only if its argument is
neither infinite nor a NaN. Note that this is not the same as (not
(inf? x)) or (not (infinite? x)), since NaNs are neither finite nor
infinite.
* test-suite/tests/numbers.test: Add test cases for `finite?'.
* module/rnrs/base.scm: Import `inf?' as `infinite?' instead of
reimplementing it. Previously, the R6RS implementation of
`infinite?' did not detect non-real complex infinities, nor did it
throw exceptions for non-numbers. (Note that NaNs _are_ considered
numbers by scheme, despite their name).
Import `finite?' instead of reimplementing it. Previously, the R6RS
implementation of `finite?' returned #t for both NaNs and non-real
complex infinities, in violation of R6RS.
* NEWS: Add NEWS entries, and reorganize existing numerics-related
entries together under one subheading.
* doc/ref/api-data.texi (Real and Rational Numbers): Add docs for
`finite?' and scm_finite_p.
Diffstat (limited to 'doc/ref/api-data.texi')
-rwxr-xr-x | doc/ref/api-data.texi | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi index 4835f3028..fc253b046 100755 --- a/doc/ref/api-data.texi +++ b/doc/ref/api-data.texi @@ -549,7 +549,8 @@ While @samp{+nan.0} is not @code{=} to itself, it is @code{eqv?} to itself. To test for the special values, use the functions @code{inf?} and -@code{nan?}. +@code{nan?}. To test for numbers than are neither infinite nor a NaN, +use @code{finite?}. @deffn {Scheme Procedure} real? obj @deffnx {C Function} scm_real_p (obj) @@ -597,6 +598,12 @@ Return @code{#t} if @var{x} is either @samp{+inf.0} or @samp{-inf.0}, Return @code{#t} if @var{x} is @samp{+nan.0}, @code{#f} otherwise. @end deffn +@deffn {Scheme Procedure} finite? x +@deffnx {C Function} scm_finite_p (x) +Return @code{#t} if @var{x} is neither infinite nor a NaN, +@code{#f} otherwise. +@end deffn + @deffn {Scheme Procedure} nan @deffnx {C Function} scm_nan () Return NaN. |