Board index » delphi » Using integers larger than 2 000 000 000 in Delphi 3 ?!

Using integers larger than 2 000 000 000 in Delphi 3 ?!

How (if it is possible) can I use and what type of data to store
numbers larger than 2 000 000 000 in Delphi 3 ? It wont work with
Longint and Dword ... and Deplhi 3 does not support anything else
(AFAIK) ...

Arminio_Gr...@Yahoo.com
http://www.geocities.com/SiliconValley/Way/9629/arminio.htm

 

Re:Using integers larger than 2 000 000 000 in Delphi 3 ?!


Quote
Arminio Grgic wrote:

> Re: Using integers larger than 2 000 000 000 in Delphi 3 ?!

> How (if it is possible) can I use and what type of data to store
> numbers larger than 2 000 000 000 in Delphi 3 ?

If you are worrying about the binary representation inaccuracy,
then how about using Currency data type? It stores the values in
exact integer representatons.

Markku Nevalainen

Re:Using integers larger than 2 000 000 000 in Delphi 3 ?!


Delphi (and the x86 microprocessor) stop at 32-bit integers ... +/-
2,147,483,647.  

But you can extend the integer arithmetic to any number of consecutive
fullwords with appropriate instructions.  Search the web... _someone has
done this.

[You can also do "unlimited precision" decimal arithmetic.]

Quote
>Arminio Grgic wrote:

> How (if it is possible) can I use and what type of data to store
> numbers larger than 2 000 000 000 in Delphi 3 ? It wont work with
> Longint and Dword ... and Deplhi 3 does not support anything else
> (AFAIK) ...

----------------------------------------------------------------
Sundial Services :: Scottsdale, AZ (USA) :: (480) 946-8259
mailto:i...@sundialservices.com  (PGP public key available.)
Quote
> Fast(!), automatic table-repair with two clicks of the mouse!
> ChimneySweep(R):  Release 4.0 is here!!
> http://www.sundialservices.com/products/chimneysweep

Re:Using integers larger than 2 000 000 000 in Delphi 3 ?!


My D3 programming is a bit rust.  See if theres a variable type called COMP
or EXTENDED.

Quote
"Arminio Grgic" <Arminio_Gr...@Yahoo.com> wrote in message

news:3c25f64a.4841281@news.zap.hr...
Quote
> How (if it is possible) can I use and what type of data to store
> numbers larger than 2 000 000 000 in Delphi 3 ? It wont work with
> Longint and Dword ... and Deplhi 3 does not support anything else
> (AFAIK) ...

> Arminio_Gr...@Yahoo.com
> http://www.geocities.com/SiliconValley/Way/9629/arminio.htm

Re:Using integers larger than 2 000 000 000 in Delphi 3 ?!


JRS:  In article <3c25f64a.4841...@news.zap.hr>, seen in news:comp.lang.
pascal.delphi.misc, Arminio Grgic <Arminio_Gr...@Yahoo.com> wrote at
Sun, 23 Dec 2001 15:22:21 :-

Quote
>How (if it is possible) can I use and what type of data to store
>numbers larger than 2 000 000 000 in Delphi 3 ? It wont work with
>Longint and Dword ... and Deplhi 3 does not support anything else
>(AFAIK) ...

        DCC32 -cc -dprogram longcalc.pas              

compiles to an EXE - needs version.pas - both via sig line 3 below.

It does integer arithmetic on up to 99999999 digits base 2..16, and is
programmable in RPN.

If, however, you only need to go up to 2^63-1, define a record of, say,
an integer and a dword, and program arithmetic as you would for paper-
and-pencil with ordinary numbers in 00..99.

Alternatively,  comp  is a 64-bit integer in effect.

--
? John Stockton, Surrey, UK.  j...@merlyn.demon.co.uk   Turnpike v4.00   MIME. ?
 Web <URL: http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
 PAS, EXE in <URL: http://www.merlyn.demon.co.uk/programs/> - see 00index.txt.
 Do not Mail News to me.    Before a reply, quote with ">" or "> " (SoRFC1036)

Re:Using integers larger than 2 000 000 000 in Delphi 3 ?!


The question before the house is whether Arminio needs to process the
number as an integer or as floating-point.

An integer number exactly stores all of the digits, all of which are
presumed to be to the left of the decimal point, and does so in binary
form.  The number "123" is therefore the binary number $7B ... that is
to say, 0111 1011.  {The "$7B" is hexadecimal notation, where each digit
represents 4 bits.}  The x86 natively handles numbers up to 32 bits wide
but can handle any number of 32-bit groups.

A large number can also be expressed in "BCD" or "packed decimal" form,
where each group of 4 bits is used to represent one decimal digit, and
all of the arithmetic is done in decimal form as you do it on your
fingers.  Any number of decimal digits may be programmed.

Finally, a floating-point number represents the value as a certain
number of "significant digits" (the mantissa), and a separate number
indicating the position of the decimal point (the exponent).  This can
handle numbers of extraordinary amount but only handles a certain number
of "good" digits.  There's always some fuzz, sometimes a lot of fuzz, in
floating point.

Quote
>Stephen wrote:

> My D3 programming is a bit rust.  See if theres a variable type called COMP
> or EXTENDED.

> "Arminio Grgic" <Arminio_Gr...@Yahoo.com> wrote in message
> news:3c25f64a.4841281@news.zap.hr...
> > How (if it is possible) can I use and what type of data to store
> > numbers larger than 2 000 000 000 in Delphi 3 ? It wont work with
> > Longint and Dword ... and Deplhi 3 does not support anything else
> > (AFAIK) ...

----------------------------------------------------------------
Sundial Services :: Scottsdale, AZ (USA) :: (480) 946-8259
mailto:i...@sundialservices.com  (PGP public key available.)
Quote
> Fast(!), automatic table-repair with two clicks of the mouse!
> ChimneySweep(R):  Release 4.0 is here!!
> http://www.sundialservices.com/products/chimneysweep

Re:Using integers larger than 2 000 000 000 in Delphi 3 ?!


I saw no mention of his debating on whether to use a floating point, or an
integer value.  I ~DID~ see that he asked what kind of variable type could
store values larger than 2bill.

COMP and EXTENDED do the trick.

Quote
"Sundial Services" <info_...@sundialservices.com> wrote in message

news:3C274B2E.1029@sundialservices.com...
Quote
> The question before the house is whether Arminio needs to process the
> number as an integer or as floating-point.

> An integer number exactly stores all of the digits, all of which are
> presumed to be to the left of the decimal point, and does so in binary
> form.  The number "123" is therefore the binary number $7B ... that is
> to say, 0111 1011.  {The "$7B" is hexadecimal notation, where each digit
> represents 4 bits.}  The x86 natively handles numbers up to 32 bits wide
> but can handle any number of 32-bit groups.

> A large number can also be expressed in "BCD" or "packed decimal" form,
> where each group of 4 bits is used to represent one decimal digit, and
> all of the arithmetic is done in decimal form as you do it on your
> fingers.  Any number of decimal digits may be programmed.

> Finally, a floating-point number represents the value as a certain
> number of "significant digits" (the mantissa), and a separate number
> indicating the position of the decimal point (the exponent).  This can
> handle numbers of extraordinary amount but only handles a certain number
> of "good" digits.  There's always some fuzz, sometimes a lot of fuzz, in
> floating point.

> >Stephen wrote:

> > My D3 programming is a bit rust.  See if theres a variable type called
COMP
> > or EXTENDED.

> > "Arminio Grgic" <Arminio_Gr...@Yahoo.com> wrote in message
> > news:3c25f64a.4841281@news.zap.hr...
> > > How (if it is possible) can I use and what type of data to store
> > > numbers larger than 2 000 000 000 in Delphi 3 ? It wont work with
> > > Longint and Dword ... and Deplhi 3 does not support anything else
> > > (AFAIK) ...
> ----------------------------------------------------------------
> Sundial Services :: Scottsdale, AZ (USA) :: (480) 946-8259
> mailto:i...@sundialservices.com  (PGP public key available.)
> > Fast(!), automatic table-repair with two clicks of the mouse!
> > ChimneySweep(R):  Release 4.0 is here!!
> > http://www.sundialservices.com/products/chimneysweep

Re:Using integers larger than 2 000 000 000 in Delphi 3 ?!


In article <hVQW7.19383$eo1.2934...@news20.bellglobal.com>,
idontk...@somewhere.asdf says...

Quote
> > > "Arminio Grgic" <Arminio_Gr...@Yahoo.com> wrote in message
> > > news:3c25f64a.4841281@news.zap.hr...
> > > > How (if it is possible) can I use and what type of data to store
> > > > numbers larger than 2 000 000 000 in Delphi 3 ? It wont work with
> > > > Longint and Dword ... and Deplhi 3 does not support anything else
> > > > (AFAIK) ...

Delphi 6 has a int64 (64 bit integer) type

Otherwise you must make your own representation out of smaller integers,
or use one of the floating point types - so long as you don't need exact
representation.

--
aaronl at consultant dot com

Other Threads