Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2014-02

real, float, double specs

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin Frb

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

Show quoted text 15 lines
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?
(later dwarf give bit sizes for the exponent.)

http://www.freepascal.org/docs-html/prog/progsu157.html#x200-2050008.2.5 is missing images?

Reply by email

Ralf Quint
to Martin Frb
Martin Frb wrote 35 lines
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...

Ralf

---
This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com

Reply by email

Sven Barth
to Ralf Quint
Ralf Quint wrote 42 lines
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

Reply by email