summaryrefslogtreecommitdiff
path: root/libguile/numbers.h
diff options
context:
space:
mode:
Diffstat (limited to 'libguile/numbers.h')
-rw-r--r--libguile/numbers.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/libguile/numbers.h b/libguile/numbers.h
index 4172c703e..10e8eddc9 100644
--- a/libguile/numbers.h
+++ b/libguile/numbers.h
@@ -121,6 +121,16 @@
/* Numbers
*/
+
+/* Note that scm_tc16_real and scm_tc16_complex are given tc16-codes that only
+ * differ in one bit: This way, checking if an object is an inexact number can
+ * be done quickly (using the TYP16S macro). */
+
+/* Number subtype 1 to 3 (note the dependency on the predicate SCM_NUMP) */
+#define scm_tc16_big (scm_tc7_number + 1 * 256L)
+#define scm_tc16_real (scm_tc7_number + 2 * 256L)
+#define scm_tc16_complex (scm_tc7_number + 3 * 256L)
+
#define SCM_INEXACTP(x) (!SCM_IMP (x) && SCM_TYP16S (x) == scm_tc16_real)
#define SCM_REALP(x) (!SCM_IMP (x) && SCM_TYP16 (x) == scm_tc16_real)
#define SCM_COMPLEXP(x) (!SCM_IMP (x) && SCM_TYP16 (x) == scm_tc16_complex)
@@ -136,7 +146,7 @@
#define SCM_NUMBERP(x) (SCM_INUMP(x) || SCM_NUMP(x))
#define SCM_NUMP(x) (!SCM_IMP(x) \
- && (0xfcff & SCM_CELL_TYPE (x)) == scm_tc7_smob)
+ && (0xfcff & SCM_CELL_TYPE (x)) == scm_tc7_number)