1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 13:30:26 +02:00

* numbers.h (SCM_NUM2DBL): New macro. Complements SCM_NUMBERP.

This macro is useful in applications.
This commit is contained in:
Mikael Djurfeldt 1998-07-02 16:39:44 +00:00
parent dbb25e7f71
commit 9d0b279fee
2 changed files with 20 additions and 0 deletions

View file

@ -1,3 +1,8 @@
1998-07-02 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
* numbers.h (SCM_NUM2DBL): New macro. Complements SCM_NUMBERP.
This macro is useful in applications.
1998-06-21 Mikael Djurfeldt <mdj@barbara.nada.kth.se>
* load.c (scm_internal_parse_path): Renamed from scm_parse_path.

View file

@ -185,11 +185,26 @@
#ifdef SCM_FLOATS
#define SCM_NUMBERP(x) (SCM_INUMP(x) || (SCM_NIMP(x) && SCM_NUMP(x)))
#ifdef SCM_BIGDIG
#define SCM_NUM2DBL(x) (SCM_INUMP (x) \
? (double) SCM_INUM (x) \
: (SCM_REALP (x) \
? SCM_REALPART (x) \
: scm_big2dbl (x)))
#else
#define SCM_NUM2DBL(x) (SCM_INUMP (x) \
? (double) SCM_INUM (x) \
: SCM_REALPART (x))
#endif
#else
#ifdef SCM_BIGDIG
#define SCM_NUMBERP(x) (SCM_INUMP(x) || (SCM_NIMP(x) && SCM_NUMP(x)))
#define SCM_NUM2DBL(x) (SCM_INUMP (x) \
? (double) SCM_INUM (x) \
: scm_big2dbl (x))
#else
#define SCM_NUMBERP SCM_INUMP
#define SCM_NUM2DBL(x) ((double) SCM_INUM (x))
#endif
#endif
#define SCM_NUMP(x) ((0xfcff & (int)SCM_CAR(x))==scm_tc7_smob)