Re: reading in int and real values



adebayo.alabi@xxxxxxx wrote in message <1130507132.371350.164510@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>...
>Hi,
>I would like to read in the following (mixed) numbers:
>
>1
>-7.5353456456
>1
>-6.5435346666
>1
>0.029633
>-0.1
>0.18363636
>...
>
>I have tried to read the numbers using the following formats but got
>ugly outputs:

What kinds of ugly outputs?
How have you declared the variable that is to receive the
inputs? DOUBLE PRECISION? If not, only the first 6 digits or so
will be used, remaining ones will be jibberish.
The format is inadequate for some of the numbers - the
number -7.5353456456 would require F13.4 because the
count (13) must include the minus sign and the decimal point.

And, as other posters have pointed out, better to use
list-directed input e.g.,
READ (8,*) VALUE
[where VALUE is defined as DOUBLE PRECISION.]

>FORMAT(F12.4)
>AND
>FORMAT(E12.6)
>
>Does anyone know hoe to read these numbers accurately?
>Regards.






.



Relevant Pages

  • Re: how do I get more numbers past the decimal?
    ... Other common formats are 64 ... So for the multi precision arithmetic, ... BCD is no more and no less accurate on generic numbers than anything else., its virtue is its exact reproduction of decimal numbers like 12.3456. ... With BCD you generally use one byte per significant digit, so its as precise on the mantissa as the number of bytes allocated. ...
    (comp.lang.php)
  • Re: how do I get more numbers past the decimal?
    ... Other common formats are 64 ... PHP implementations tend to use IEEE doubles on machines that have ... 32-bit floating point numbers tend to have not enough precision to ... So for the multi precision arithmetic, ...
    (comp.lang.php)
  • Re: extended precision OPTERON
    ... Well, IBM did it, but then they designed the extended precision ... It might help a little for divide. ... popular 80 bit formats are enough. ... Though what IBM did with S/370, support all except divide, and emulate ...
    (comp.lang.fortran)