Real precision
Author Message
Real precision

Can anyone tell me what the precision is of standard Pascals real data type?

I think it is 11 or 12 but not sure which.

Thanks
Darryl

Tue, 29 Jul 2003 22:50:53 GMT
Real precision

Quote:

>Can anyone tell me what the precision is of standard pascals real data type?

It is in bits, not digits.  It is a little more than 11 digits.

Wed, 30 Jul 2003 07:45:00 GMT
Real precision

Quote:

> Can anyone tell me what the precision is of standard pascals real data type?

> I think it is 11 or 12 but not sure which.

Are you sure that "Standard" Pascal defines the accuracy (resolution)
of the "REAL" type, independent of the CPU/computer - implementation?

Or is the "standard" now fixed to the IBM - PC and its
derivatives? Hopefully not! ;-(

Greetings
--
Franz Glaser, Glasau 3, A-4191 Vorderweissenbach Austria +43-7219-7035-0
Muehlviertler Elektronik Glaser.  Industrial control and instrumentation
http://members.eunet.at/meg-glaser/    http://members.xoom.com/f_glaser/
http://www.geocities.com/~franzglaser/            http://start.at/bedarf

Wed, 30 Jul 2003 21:36:47 GMT
Real precision
On Sat, 10 Feb 2001 14:36:47 +0100, "Ing. Franz Glaser"

Quote:

>> Can anyone tell me what the precision is of standard pascals real data type?

>> I think it is 11 or 12 but not sure which.

>Are you sure that "Standard" Pascal defines the accuracy (resolution)
>of the "REAL" type, independent of the CPU/computer - implementation?

>Or is the "standard" now fixed to the IBM - PC and its
>derivatives? Hopefully not! ;-(

>Greetings

The _User Manual and Report_ entry for "the type real" says:

A value of type real is an element of the
IMPLEMENTATION-DEFINED subest of real numbers.
[Emphasis mine]

Cooper's _Standard Pascal_ says:

There are limits to the accuracy with which mathematical reals are
represented within computers, as well as bounds on their magnitude;
thus type /real/ is an IMPLEMENTATION-DEFINED subset of the real
numbers. [Emphasis mine again]

Sounds to me like "standard pascal" doesn't have much to say on the
precision of any actual implementation of type real.

But I fear you may be correct that "standard" now means PC, and likely
a Borland dialect at that.

Stephen Posey

Thu, 31 Jul 2003 05:30:07 GMT
Real precision
Thanks for the response,

It is machine and implementation dependent - thats fair enough.
So if we are talking about turbo Pascal on the PC then what is the precision
of the real type?

Thanks
Darryl.

Fri, 01 Aug 2003 19:38:51 GMT
Real precision

Quote:

> Thanks for the response,

> It is machine and implementation dependent - thats fair enough.
> So if we are talking about turbo Pascal on the PC then what is the precision
> of the real type?

The very old TP compilers used a special REAL type, it was better
than the 4-Byte REAL of BASIC, but worse than the EXTENDED real
type that is used now with the 80x87 math extensions.

The TP real uses 6-Bytes in memory. One byte is used for the
exponent and the other 5 are used for the mantissa. The range
is approximately 10^+-32

You find more in the net, http://bsn.ch/tp-links
chapters "numeric" or "math" amd in the FAQ chapter.

Not that 0.1 and 0.01 ... cannot be expressed in binary correctly.

Greetings.
--
Franz Glaser, Glasau 3, A-4191 Vorderweissenbach Austria +43-7219-7035-0
Muehlviertler Elektronik Glaser.  Industrial control and instrumentation
http://members.eunet.at/meg-glaser/    http://members.xoom.com/f_glaser/
http://www.geocities.com/~franzglaser/            http://start.at/bedarf

Sat, 02 Aug 2003 05:19:34 GMT
Real precision

at Mon, 12 Feb 2001 11:38:51 :-

Quote:
>Thanks for the response,

>It is machine and implementation dependent - thats fair enough.
>So if we are talking about turbo Pascal on the PC then what is the precision
>of the real type?

In that case, you should be asking in c.l.p.borland, not here.

But, as QUB Modern History has just helped me, see Web <URL: http://www.
merlyn.demon.co.uk/pas-type.htm#FF> - 11 significant digits.  My pas-
real.htm explains why you should not use that type.

OOps - mistake - it was TCD, not QUB.  Never mind.

--

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

Sat, 02 Aug 2003 04:55:32 GMT
Real precision

wrote at Mon, 12 Feb 2001 22:19:34 :-

Quote:

>> Thanks for the response,

>> It is machine and implementation dependent - thats fair enough.
>> So if we are talking about turbo Pascal on the PC then what is the precision
>> of the real type?

>The very old TP compilers used a special REAL type, it was better
>than the 4-Byte REAL of BASIC, but worse than the EXTENDED real
>type that is used now with the 80x87 math extensions.

>The TP real uses 6-Bytes in memory. One byte is used for the
>exponent and the other 5 are used for the mantissa. The range
>is approximately 10^+-32

The range is slightly bigger than +-10^+-38 - not 32; however, it was
the precision that was asked for.  Both are in Web <URL: http://www.
merlyn.demon.co.uk/pas-type.htm#FF>.

--

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

Sat, 02 Aug 2003 21:29:10 GMT
Real precision

Quote:

> Can anyone tell me what the precision is of standard pascals real data type?

> I think it is 11 or 12 but not sure which.

> Thanks
> Darryl

As somebody else mentioned, the Pascal standards (ISO 7185 and ISO
10206) do not require any particular precision for real or integer
types.  Its all left to an implementation to define MAXINT and MAXREAL.
You can be standards conformant (albeit, not very useful), if you only
provide 1 digit of precision.

--
John Reagan