Reading and writing doubles
From: Chris Cowley (ccowley_at_swenA-fodder.grok.co.uk)
Date: 10/16/03
- Next message: Perry Way: "Re: Rewrite last line in text file"
- Previous message: Perry Way: "Re: Html parsing"
- Next in thread: Perry Way: "Re: Reading and writing doubles"
- Reply: Perry Way: "Re: Reading and writing doubles"
- Reply: Glynn Owen: "Re: Reading and writing doubles"
- Reply: John Herbster \(TeamB\): "Re: Reading and writing doubles"
- Reply: Mike Williams (TeamB): "Re: Reading and writing doubles"
- Reply: Thomas Mueller: "Re: Reading and writing doubles"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 16 Oct 2003 17:22:19 +0100
What is the most efficient way to set and read the value of 'double'
floating point values in Delphi (v5 in case that matters) using the
internal 8-byte exponent+manstissa representation?
At the moment I am using a TMemoryStream to convert between a double and
an array of bytes, like this:-
var
ms: TMemoryStream;
z: double;
b: array[0..7] of byte;
egin
z := 3.141592;
ms := TMemoryStream.Create;
ms.Write(z,8);
ms.Seek(0,soFromBeginning);
ms.Read(b,8);
ms.Free;
This works, but I can't help but feel there must be a much more
efficient way of doing it, using a pointer to the double or something.
Any ideas?
Thanks.
-- Chris Cowley ccowley @ grok.co.uk
- Next message: Perry Way: "Re: Rewrite last line in text file"
- Previous message: Perry Way: "Re: Html parsing"
- Next in thread: Perry Way: "Re: Reading and writing doubles"
- Reply: Perry Way: "Re: Reading and writing doubles"
- Reply: Glynn Owen: "Re: Reading and writing doubles"
- Reply: John Herbster \(TeamB\): "Re: Reading and writing doubles"
- Reply: Mike Williams (TeamB): "Re: Reading and writing doubles"
- Reply: Thomas Mueller: "Re: Reading and writing doubles"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|