On May 22, 2007, at 10:50 AM, Dan Muresan wrote:
Hi,
I've just realized that "normal" Chicken integers are 31 bits wide:
csi> (inexact->exact 1073741824)
[ nasty error ]
csi> (inexact->exact 1073741823)
1073741823
csi> (/ (log 1073741824) (log 2))
30.0
Wider integers are promoted to flonums.
Or to bignums with the numbers egg (full numeric tower).
#;1> (use numbers)
; loading /usr/local/lib/chicken/1x/numbers.scm ...
; loading /usr/local/lib/chicken/1x/numbers-base.so ...
#;2> (inexact->exact 1073741824)
1073741824
Means you want to compile w/ generic-arithmetic & usual-integrations
when using a foreign call.
This is somewhat undesirable when interfacing to C libraries.
Especially if you didn't expect it. (It is documented but a tutorial
on foreign function interfacing would be nice.)
If you use one of integer unsigned-integer integer32 unsigned-
integer32 integer64 long unsigned-long as a foreign parameter/return
type Chicken will automatically convert a flonum integer to/from the
native type.
Is there a native-integer type (like in OCaml)? Since the SRFI-4
vectors have exact 8, 16 and 32-bit integer elements, it might make
sense to have native integers too...
Sort of, see above. Note that SRFI-4 doesn't define any arithmetic.
Would the native integers be part of the numeric tower? If so this is
a major piece of work. If disjoint from the number type then fairly
straightforward to create but of limited utility.
Best Wishes,
Kon
Cheers,
Dan
_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users
_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users