[fpc-devel] real, float, double specs

Sven Barth pascaldragon at googlemail.com
Wed Feb 12 09:09:02 CET 2014


Am 12.02.2014 02:42, schrieb Ralf Quint:
> On 2/11/2014 4:53 PM, Martin Frb wrote:
>> I am trying to figure out the internal representation of these. (So 
>> they can be converted, including conversion form sizes not present in 
>> fpc)
>>
>> They are all floating point? Pascal has no fixed point? 
>> (nevertheless, rules for fixed point may also be of interest)
>>
>> dwarf2 says it is specified in each platforms ABI, but I have not 
>> found that (not even found the ABI yet).
>> Only found: 
>> http://en.wikipedia.org/wiki/Computer_number_format#Representing_fractions_in_binary
>>
>> And http://www.freepascal.org/docs-html/ref/refsu6.html#x28-310003.1.2
>>
>>> Type 	Range 	Significant digits 	Size
>>> ------------------------------------------------------------------------
>>> 	
>>> ------------------------------------------------------------------------
>>> 	
>>> ------------------------------------------------------------------------
>>> 	
>>> ------------------------------------------------------------------------
>>> Real 	platform dependant 	??? 	4 or 8
>>> Single 	1.5E-45 .. 3.4E38 	7-8 	4
>>> Double 	5.0E-324 .. 1.7E308 	15-16 	8
>>> Extended 	1.9E-4932 .. 1.1E4932 	19-20 	10
>>> Comp 	-2E64+1 .. 2E63-1 	19-20 	8
>>> Currency 	-922337203685477.5808 .. 922337203685477.5807 	19-20 	8
>>>
>> apparently there also is real46 (never heard of real16)
>>
>> The size will actually be in the dwarf, so that I got.
>>
>> But from that how do I know how many bits are in the exponent? (and 
>> how many in the number). Apparently it depends on the CPU? But where 
>> to get the info?
> For all but Real48 (not Real46 or Real16), those are conformant with 
> IEEE 754 (http://grouper.ieee.org/groups/754/)
>
> Real48 is the non-IEEE754 (predating it) floating point format that 
> was used in the early Borland Turbo Pascal...
Please not that FPC declares Real48 (aka Real) as "type Double" (in 
$fpcdir/rtl/inc/systemh.inc) so it does NOT implement it in a TP 
compatible way.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140212/071d3e19/attachment.html>


More information about the fpc-devel mailing list