Leif
A double is a real number wich occupies 8 bytes. A cardinal is a generic
type, but in 32-bit Delphi it designates a 32 bit unsigned integer. This
means that numbers beyond the range of a 32 bit unsigned value (4294967295)
can not be stored in them. Considering this, you could use Trunc() or
Round().
Guido GYBELS
Programmer (GDG GROEP BELGIUM)
Leif Lundberg heeft geschreven in bericht
<7kqhqo$a2...@forums.borland.com>...
Acardinal := trunc(Adouble);
or
Acardinal := round(Adouble);
--
bob
myName = 'bobmackey';
myISP = 'annapolis.net';
myaddress := myName + '@' + myISP;
I'm aware of this but I can't use trunc or round, they are returning a
longint I need it to be unsigned 32bit
Here's my problem, In the header of a PDB file (database file for a palm
III) ther is three fields that are numeric and 4bytes eatch, this fields
expresses a date as a number of seconds since january 1 1904.
If a convert a TDatetime of today to seconds the value will be out of bounds
on a longint.
So I need to store my calculated value (double) in 4 byte.
Any ideas?
Leif
Adding to Guido and Bob -- Before D4 "cardinals" are actually integers. You
lose the use of the highest bit, it's still a sign bit.
PhR
Store them in an int64 or COMP and then take the lowermost 4 bytes of that as
your cardinal.
Var
i: int64;
c: Cardinal absolute i;
Begin
i := Round( .... );
If you don't have D4 use COMP instead of int64 and remove the Round, COMP is a
floating point type.
Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
I think that's the answer I was looking for, thanks...
Leif