Sign in Join

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

Mailing lists / fpc-pascal / 2004-08

How to convert between double and extended?

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

Mattias Gaertner

Hi,

How can I convert between PowerPC double and i386 Extended on a powerpc? For example: I want to save a Double under powerpc to a stream as i386 Extended and read it under i386 as Extended.

Are there already some conversion functions to convert between the various floating point formats?

Mattias

Jonas Maebe
to Mattias Gaertner
Mattias Gaertner wrote 8 lines
How can I convert between PowerPC double and i386 Extended on a powerpc? For example: I want to save a Double under powerpc to a stream as i386 Extended and read it under i386 as Extended. Are there already some conversion functions to convert between the various floating point formats?

No, only a function to convert a TP real to double (real2double). Also, on the ppc extended is defined as double (for source code compatibility), so we'll have to use a record or so.

Jonas

Mattias Gaertner
to Jonas Maebe
Show quoted text 15 lines
On 14 aug 2004, at 19:34, Mattias Gaertner wrote: > How can I convert between PowerPC double and i386 Extended on a > powerpc? > For example: I want to save a Double under powerpc to a stream as i386 > Extended and read it under i386 as Extended. > > Are there already some conversion functions to convert between the > various > floating point formats? No, only a function to convert a TP real to double (real2double). Also, on the ppc extended is defined as double (for source code compatibility), so we'll have to use a record or so.

That's why I asked.

Where can I get information about the i386 extended and the ppc double format? Is it correct, that the ppc double is simply a reversed i386 double?

Mattias

Florian Klaempfl
to Mattias Gaertner
Mattias Gaertner wrote 24 lines
On Sun, 15 Aug 2004 00:11:16 +0200 Jonas Maebe wrote: >On 14 aug 2004, at 19:34, Mattias Gaertner wrote: > > >>How can I convert between PowerPC double and i386 Extended on a >>powerpc? >>For example: I want to save a Double under powerpc to a stream as i386 >>Extended and read it under i386 as Extended. >> >>Are there already some conversion functions to convert between the >>various >>floating point formats? > >No, only a function to convert a TP real to double (real2double). Also, >on the ppc extended is defined as double (for source code >compatibility), so we'll have to use a record or so. That's why I asked. Where can I get information about the i386 extended and the ppc double format? Is it correct, that the ppc double is simply a reversed i386 double?

Yes. rtl/inc/real2str.inc around 260 shows how to split the different float types.

Show quoted text 7 lines
Mattias _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal