[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] 32 bit integers?
From: |
Dan Muresan |
Subject: |
Re: [Chicken-users] 32 bit integers? |
Date: |
Tue, 22 May 2007 22:33:19 +0300 |
User-agent: |
Thunderbird 1.5.0.10 (X11/20070306) |
Wider integers are promoted to flonums.
Or to bignums with the numbers egg (full numeric tower).
Right, that's why I specified "normal" numbers.
Especially if you didn't expect it. (It is documented but a tutorial on
foreign function interfacing would be nice.)
Actually, I haven't found the 31-bit format documented anywhere (maybe I
missed it). I thought that at least normal C int's would always fit in a
fixnum. It was an unpleasant surprise to see an expression like (logior
flags ...) fail, when "flags" was promoted to a flonum.
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.
Yes, but flonum's can't be used in some contexts:
* bit ops
* modulo-2^32 arithmetic (i.e. C-like 32-bit wraparound arithmetic)
I don't see a way to hack these using flonums. Bignums would solve the
problem but they're slow.
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.
I'm not really sure what "disjoint" means here... They would be
available without (require-extension numbers). There would be separate
functions native+, native* etc. OCaml has native integers for this very
reason.
Best,
Dan
- [Chicken-users] 32 bit integers?, Dan Muresan, 2007/05/22
- Re: [Chicken-users] 32 bit integers?, Kon Lovett, 2007/05/22
- Re: [Chicken-users] 32 bit integers?,
Dan Muresan <=
- Re: [Chicken-users] 32 bit integers?, Kon Lovett, 2007/05/22
- Re: [Chicken-users] 32 bit integers?, Kon Lovett, 2007/05/22
- Re: [Chicken-users] 32 bit integers?, Dan Muresan, 2007/05/22
- Re: [Chicken-users] 32 bit integers?, John Cowan, 2007/05/22
- Re: [Chicken-users] 32 bit integers?, Kon Lovett, 2007/05/22
- Re: [Chicken-users] 32 bit integers?, Dan Muresan, 2007/05/22
- Message not available
- Re: [Chicken-users] 32 bit integers?, Kon Lovett, 2007/05/23