Re: [fpc-pascal] Writing floating points to steams

2016-01-16 Thread Sven Barth
Am 16.01.2016 10:30 schrieb "Dennis" : > > > > Sven Barth wrote: >> >> >>> Should writing binary floating point to a stream note that it's IEEE format, just in case anybody ever tries to process it on a platform that supports alternatives? >> >> >>> >> >> It would be great if storing floating point

Re: [fpc-pascal] Writing floating points to steams

2016-01-16 Thread Dennis
Sven Barth wrote: >>> Should writing binary floating point to a stream note that it's IEEE format, just in case anybody ever tries to process it on a platform that supports alternatives? >>> >> It would be great if storing floating point could be in IEEE, to have a standard as reference. >

Re: [fpc-pascal] Writing floating points to steams

2016-01-15 Thread Michael Schnell
On 01/13/2016 10:06 AM, Mark Morgan Lloyd wrote: Can I ask a naive question here please: does a binary stream store endianness anywhere? AFAIK, generally, such binary (file-, Network transfer, ) formats are not supposed to be "natively" portable. To be portable they should be either propr

Re: [fpc-pascal] Writing floating points to steams

2016-01-13 Thread Marco van de Voort
In our previous episode, Torsten Bonde Christiansen said: > I'm not even sure how (or even if) TStream decendants handles endianness > for integers I'm guessing they are not. TStream is basically an abstraction for stream of bytes. The read methods are just convenience, not some protocol. As

Re: [fpc-pascal] Writing floating points to steams

2016-01-13 Thread Sven Barth
Am 13.01.2016 13:16 schrieb "Torsten Bonde Christiansen" : > > On 2016-01-13 10:40, Mark Morgan Lloyd wrote: >> >> Torsten Bonde Christiansen wrote: >>> >>> On 2016-01-13 10:06, Mark Morgan Lloyd wrote: Serguei TARASSOV wrote: > > On 13/01/2016 08:47, fpc-pascal-requ...@lists.free

Re: [fpc-pascal] Writing floating points to steams

2016-01-13 Thread Torsten Bonde Christiansen
On 2016-01-13 10:40, Mark Morgan Lloyd wrote: Torsten Bonde Christiansen wrote: On 2016-01-13 10:06, Mark Morgan Lloyd wrote: Serguei TARASSOV wrote: On 13/01/2016 08:47, fpc-pascal-requ...@lists.freepascal.org wrote: On 2016-01-12 10:45, Torsten Bonde Christiansen wrote: Since TStream doesn'

Re: [fpc-pascal] Writing floating points to steams

2016-01-13 Thread Sven Barth
Am 13.01.2016 10:40 schrieb "Mark Morgan Lloyd" < markmll.fpc-pas...@telemetry.co.uk>: > > Torsten Bonde Christiansen wrote: >> >> On 2016-01-13 10:06, Mark Morgan Lloyd wrote: >>> >>> Serguei TARASSOV wrote: On 13/01/2016 08:47, fpc-pascal-requ...@lists.freepascal.org wrote: > >

Re: [fpc-pascal] Writing floating points to steams

2016-01-13 Thread Marco van de Voort
In our previous episode, Torsten Bonde Christiansen said: > What is the best/preferred way to write floatingpoint to a steam? var d : double; // or single, avoid extended d:=; stream.write(d,sizeof(d)); stream.read(d,sizeof(d)); All the stream helpers are just that. One could add writedouble/

Re: [fpc-pascal] Writing floating points to steams

2016-01-13 Thread Mark Morgan Lloyd
Torsten Bonde Christiansen wrote: On 2016-01-13 10:06, Mark Morgan Lloyd wrote: Serguei TARASSOV wrote: On 13/01/2016 08:47, fpc-pascal-requ...@lists.freepascal.org wrote: On 2016-01-12 10:45, Torsten Bonde Christiansen wrote: Since TStream doesn't have any native WriteFloat/Double and the li

Re: [fpc-pascal] Writing floating points to steams

2016-01-13 Thread Torsten Bonde Christiansen
On 2016-01-13 10:06, Mark Morgan Lloyd wrote: Serguei TARASSOV wrote: On 13/01/2016 08:47, fpc-pascal-requ...@lists.freepascal.org wrote: On 2016-01-12 10:45, Torsten Bonde Christiansen wrote: Since TStream doesn't have any native WriteFloat/Double and the likes, some conversion is needed - bu

Re: [fpc-pascal] Writing floating points to steams

2016-01-13 Thread Mark Morgan Lloyd
Serguei TARASSOV wrote: On 13/01/2016 08:47, fpc-pascal-requ...@lists.freepascal.org wrote: On 2016-01-12 10:45, Torsten Bonde Christiansen wrote: Since TStream doesn't have any native WriteFloat/Double and the likes, some conversion is needed - but what is a good strategy for this? Depends on

Re: [fpc-pascal] Writing floating points to steams

2016-01-13 Thread Serguei TARASSOV
On 13/01/2016 08:47, fpc-pascal-requ...@lists.freepascal.org wrote: On 2016-01-12 10:45, Torsten Bonde Christiansen wrote: Since TStream doesn't have any native WriteFloat/Double and the likes, some conversion is needed - but what is a good strategy for this? Depends on size constraints. In the

Re: [fpc-pascal] Writing floating points to steams

2016-01-12 Thread Michael Schnell
On 01/12/2016 01:40 PM, Torsten Bonde Christiansen wrote: But out of curiosity is there a reason why there are not floating point Read/Write methods for TStream (and decendants)? As procedure TStream.WriteQWord(q: QWord); begin WriteBuffer(q,8); end; it's rather easy to do

Re: [fpc-pascal] Writing floating points to steams

2016-01-12 Thread Torsten Bonde Christiansen
On 2016-01-12 12:38, Michael Van Canneyt wrote: On Tue, 12 Jan 2016, Torsten Bonde Christiansen wrote: On 2016-01-12 12:04, Graeme Geldenhuys wrote: On 2016-01-12 10:45, Torsten Bonde Christiansen wrote: Since TStream doesn't have any native WriteFloat/Double and the likes, some conversion

Re: [fpc-pascal] Writing floating points to steams

2016-01-12 Thread Michael Van Canneyt
On Tue, 12 Jan 2016, Torsten Bonde Christiansen wrote: On 2016-01-12 12:04, Graeme Geldenhuys wrote: On 2016-01-12 10:45, Torsten Bonde Christiansen wrote: Since TStream doesn't have any native WriteFloat/Double and the likes, some conversion is needed - but what is a good strategy for this?

Re: [fpc-pascal] Writing floating points to steams

2016-01-12 Thread Torsten Bonde Christiansen
On 2016-01-12 12:04, Graeme Geldenhuys wrote: On 2016-01-12 10:45, Torsten Bonde Christiansen wrote: Since TStream doesn't have any native WriteFloat/Double and the likes, some conversion is needed - but what is a good strategy for this? I use FloatStr() to do the conversion, then Write() to ac

Re: [fpc-pascal] Writing floating points to steams

2016-01-12 Thread Graeme Geldenhuys
On 2016-01-12 10:45, Torsten Bonde Christiansen wrote: > Since TStream doesn't have any native WriteFloat/Double and the likes, > some conversion is needed - but what is a good strategy for this? I use FloatStr() to do the conversion, then Write() to actually write it to a stream. Regards, -

[fpc-pascal] Writing floating points to steams

2016-01-12 Thread Torsten Bonde Christiansen
Hi all. What is the best/preferred way to write floatingpoint to a steam? Since TStream doesn't have any native WriteFloat/Double and the likes, some conversion is needed - but what is a good strategy for this? A simple conversion like Stream.WriteDWord( DWord(variable>)) is not possible due