600 Billion as an Integer; ?
Author Message
600 Billion as an Integer; ?

Hello Once again!

Is there another data type that will except numbers in excess of 600
Billion? Or am I just able to use real;  or will real; even except this high
of number?

Thanks!

:) Evan Anderson

Wed, 18 Jun 1902 08:00:00 GMT
600 Billion as an Integer; ?
Hi!

I think the only way is to use real types. And yes, a real type should be
able to except 600 Billion.

CU
Jens

--
[ HOMEPAGE: http://home.t-online.de/home/jens.gesing/index.htm ]
[ PROGRAMMING-DO-IT-YOURSELF: http://www.pdiy.de ]

Quote:
> Hello Once again!

>     Is there another data type that will except numbers in excess of 600
> Billion? Or am I just able to use real;  or will real; even except this
high
> of number?

>     Thanks!

>     :) Evan Anderson

Wed, 18 Jun 1902 08:00:00 GMT
600 Billion as an Integer; ?

Quote:
>    Is there another data type that will except numbers in excess of 600
>Billion? Or am I just able to use real;  or will real; even except this high
>of number?

In order not to confuse people from countries where they don't even
think English is the local language, please write more carefully.  You
mean "accept", not "except".  Also, some think "billion" is 1E9 and some
1E12.

You need, if representing integers, to think not only about the range,
but also the resolution.  See my Web <URL: http://www.merlyn.demon.co.uk/pas-real.htm#FloatTypes>.

Type REAL is a deprecated, 6-byte type, using 39 actual bits and one
implicit bit for the mantissa.  Now 2^40 is +1,099,511,627,776 which is
only just about enough to accommodate 600 of the puny American billion -
and remember that the least significant bit of a floating-point result
may not always be right.

Don't use REAL.

EXTENDED would do, perhaps; 63 varying bits and a ONE - 2^64 is
+18,446,744,073,709,551,616.

But you should not use that either; the hybrid COMP type is better.
Look it up in your printed manual, or in the on-line help.

--

<URL: http://www.merlyn.demon.co.uk/> TP/BP/Delphi/&c., FAQqy topics & links;
<URL: ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip> Timo Salmi's Turbo Pascal FAQ;
<URL: http://www.merlyn.demon.co.uk/clpb-faq.txt> Pedt Scragg: c.l.p.b. mFAQ.

Wed, 18 Jun 1902 08:00:00 GMT
600 Billion as an Integer; ?

Quote:

>Type REAL is a deprecated, 6-byte type, using 39 actual bits and one
>implicit bit for the mantissa.  Now 2^40 is +1,099,511,627,776 which is
>only just about enough to accommodate 600 of the puny American billion -
>and remember that the least significant bit of a floating-point result
>may not always be right.

Actually up to that number (or one below actually) reals that are used
to store integers are accurate. When reals are inaccurate there is no
simple rule how many bits may be inaccurate. They all may be. The number
may be of completely different order of magnitude etc.

Osmo

Wed, 18 Jun 1902 08:00:00 GMT
600 Billion as an Integer; ?

Quote:

> Type REAL is a deprecated, 6-byte type, using 39 actual bits and one
> implicit bit for the mantissa.  Now 2^40 is +1,099,511,627,776 which
> is only just about enough to accommodate 600 of the puny American
> billion - and remember that the least significant bit of a floating-
> point result may not always be right.

> Don't use REAL.

Unless, you're working with legacy (TP3) applications, that rely on the
internal representation of these critters, and that use inline code to
mess around with them.

Of course in this case you should upgrade your RTL to the Norbert Juffa
version (TPL60N19.ZIP/BPL70N16.ZIP), to get at least some inprovement
in speed (and accuracy)

Robert
--
Robert AH Prins

Sent via Deja.com http://www.deja.com/
Before you buy.

Wed, 18 Jun 1902 08:00:00 GMT
600 Billion as an Integer; ?

Quote:

> Hello Once again!
>     Is there another data type that will except numbers in excess of 600
> Billion? Or am I just able to use real;  or will real; even except this high
> of number?

>     Thanks!

You could also create your own new type, large enough to get it, but you
would have too to rewrite operations (+-*/) and a screenwriting
procedure (get your numb and write the character conresponding)
ideas
- a record of two or three or more integer, when the first reach
MAXINT, you increment the second, and let the first to MAXINT; your
number is var1+var2+var3
- idem, but when the first reach MAXINT, still inc VAR2, but then set
var1 to 0; your number is var1+(var2*MAXINT) (big num, no ?);
- last, heaviest to write, is ti uses a string (max 256 characters),
and work in a 36-base (0..9,A=10,..Z=36, so 10=37). Might be useful for
big workin in maths.

Wed, 18 Jun 1902 08:00:00 GMT
600 Billion as an Integer; ?

Quote:

>You could also create your own new type, large enough to get it, but you
>would have too to rewrite operations (+-*/) and a screenwriting
>procedure (get your numb and write the character conresponding)
> ideas
>    - a record of two or three or more integer, when the first reach
>MAXINT, you increment the second, and let the first to MAXINT; your
>number is var1+var2+var3
>    - idem, but when the first reach MAXINT, still inc VAR2, but then set
>var1 to 0; your number is var1+(var2*MAXINT) (big num, no ?);
>    - last, heaviest to write, is ti uses a string (max 256 characters),
>and work in a 36-base (0..9,A=10,..Z=36, so 10=37). Might be useful for
>big workin in maths.

These are hard and ineffective. The simplest is to use assembler and use
instructions ADC and SBB. These are just for that stuff.

Or if one has a coprocessor or uses emulation one could use comp.

Osmo

Wed, 18 Jun 1902 08:00:00 GMT
600 Billion as an Integer; ?

Quote:

> These are hard and ineffective. The simplest is to use assembler and use
> instructions ADC and SBB. These are just for that stuff.

Yeah, but guys who write new datas structure in assembler like we get
lunch, doesn't deserve any help (at least, they didn't need mine). Twas
just a way to solve the problem without minding of anything but Pascal.
By the way, all of my more-than-five-lines-assembler-codes could be also
called "Procedure Manual_Reboot;". Nobodies' parfect !

Wed, 18 Jun 1902 08:00:00 GMT

 Page 1 of 1 [ 8 post ]

Relevant Pages

Powered by phpBB® Forum Software