Frank Heckenbach wrote :
[...]
Sure, things can be improved, but it's not as trivial as it might seem. I don't have the time do think about it now, but if you like to try -- the code is _p_read_longreal in rts/file.c (that's in C, but if you write a better version in Pascal, that's also fine; sooner or later the code will be translated to Pascal, anyway).
Thanks. I'm afraid I'm quite unable to write a serious routine but I'll take a look at the problem.
[...]
OK, we could do 103000 / 10**3 rather than 103000 * 10**(-3)... I'm changing this now (will be uploaded soon), and then this test works indeed...
Great. Thanks. I just downloaded the new version and it works fine. In order to understand a little more, may I ask you what did you exactly change in the sources ?
I'm wondering if there's a way to write a binary (or hexadecimal) representation of the LongReal type in a text file, a clear and understandable representation that could be read back by the program without any difference with the original number. I wrote LongReal numbers to a File Of LongReal, and I translated this file into an hexadecimal representation,
Yes, that's a way to do it. (You could achieve the same within the program, by type casting to an array of bytes or something -- if you need to have a text file. Normally, a file of LongReal would be most appropriate.)
I wanted to create a data file that I can read and change into a text editor. What I did to elude the problem : I created a program that can read and write something similar to the "Hex Float" representation I discovered in GCC. There is no more change between the numbers I wrote and the numbers I read into a file. (But the "Hex Float" representation is quite exotic to me...)
[...]
The details of the representation are available in many places, I suppose. They're printed in the BP manual AFAIR, and they're probably also available on the Net.
On my computer (Intel Pentium 120 + Windows 98), "LongReal" is the Intel IEEE Double-Extended wich is 10 bytes long (but stored in 12 bytes : I didn't understand the hidden reason why...). To understand the details of this format, I found a precious help in this web page : http://cch.loria.fr/documentation/IEEE754/numerical_comp_guide/ncg_math.doc. html
--
«Couperin»