Re: help reading fortran generated binary data...



On Wed, 17 Aug 2005 19:00:08 GMT, "Jeff Godfrey"
<jeff_godfrey@xxxxxxxxx> wrote:

>
>"Helmut Giese" <hgiese@xxxxxxxxxxxxx> wrote in message
>news:430369e4.3997226@xxxxxxxxxxxxxxxxxxxxx
>> On Wed, 17 Aug 2005 16:36:03 GMT, "Jeff Godfrey"
>> <jeff_godfrey@xxxxxxxxx> wrote:
>>
>>>Hi All,
>>>
>>>First, for those not interested in the "long" story (below), here's my
>>>basic problem...
>>>
>>>I've read a value from binary file using the following code:
>>>
>>>binary scan $binaryData @${offset}d1 theData (1 double-precision
>>>floating
>>>point value)
>>>
>>>The value *should* be any of 0, 90, 180, or 270.
>>>
>>>What I get instead is 4 variations of an *extreme* (large or small)
>>>number,
>>>such as:
>>>
>>>5.4388530464437965e+185
>>
>> Hi Jeff,
>> what I would try next is to write out the 4 values you expect into a
>> binary file and have a look at it with a hex editor: question of
>> finding out what Tcl expects to see as 0, 90, 180, or 270 represented
>> as double.
>> Then look at the raw binary data you get. Can you locate the patterns
>> from above anywhere ?
>> If not, maybe FORTRAN stored doubles in a different format?
>> HTH and good luck
>> Helmut Giese
>
>Helmut,
>
>Short of anyone just "knowing" the answer
That would probably have been Arjen, Tcl's FORTRAN guru :) but he
seems to not be listening right now.

My FORTRAN days are long gone and anyway I never had to deal with
floating point values as raw binary data, so I am only guessing here.

But I wouldn't be surprised if FORTRAN (or at least a sufficiently old
compiler) did use a different means of storing doubles - I mean,
FORTRAN probably predates the IEEE standard on floating point
calculation by many years. And of course you can write them out and
read them back in using programs compiled with the same compiler -
like Borland Pascal users could when using the funny 6 byte floating
point type called Real which Borland invented - but of course nobody
else could.
If you know more details about the interpretation of your 4 values you
may want to turn to a FORTRAN news group.
Good luck
Helmut Giese

.



Relevant Pages

  • Re: Fortran 77 parser
    ... I do not remember which processor or compiler. ... choosing to use 48-bit floating point because it gave me the best ... specify precisions in fortran. ...
    (comp.lang.fortran)
  • Re: help reading fortran generated binary data...
    ... >>> Hi Jeff, ... maybe FORTRAN stored doubles in a different format? ... > floating point values as raw binary data, so I am only guessing here. ... > read them back in using programs compiled with the same compiler - ...
    (comp.lang.tcl)
  • Re: double precision difference between matlab and fortran 90
    ... 15 9's correctly but your Fortran compiler is not. ... just now to determine which is rounding correctly, ... Fortran doesn't say much about rounding of floating point, ...
    (comp.lang.fortran)
  • Re: Why float is called as float, not real?
    ... My guess is that "floating point" was used to distinguish the data representation from "fixed point." ... The oldest computer languages I've used, FORTRAN and ALGOL, both use "real," but as Glen noted, that wasn't the case with primeval FORTRAN. ... As Gib noted, even with a countably infinite number of bits, computers couldn't come close to representing all of the reals. ...
    (comp.lang.fortran)
  • Re: Fortran vs. C++ : Which is best to choose now i
    ... Your perceived clash between the treatment of floating point and integer ... genericity than language committees' opposition to the ... It has taken Fortran 20 years to provide support for ieee fp error ... How long more does one have to wait for integer overflow ...
    (comp.lang.fortran)