Nп/п : 8 из 100
 От   : Gary Scott                          2:5075/128        28 авг 23 12:59:44
 К    : Ron Shepard                                           28 авг 23 21:01:02
 Тема : Re: Real number precision in fortran
----------------------------------------------------------------------------------
                                                                                 
@MSGID: 1@dont-email.me> 7c7f055a
@REPLY: TPw2.99944@fx17.iad>
72339a46
@REPLYADDR Gary Scott <garylscott@sbcglobal.net>
@REPLYTO 2:5075/128 Gary Scott
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID: 1@dont-email.me>
@RFC-References:
<873f9cc4-6139-4bd3-9ed8-de7e37a76730n@googlegroups.com> <d24b9f27-36da-4011-963d-eba713b1f16an@googlegroups.com>
<3cb57395-be28-4451-9e98-c20ed41386fbn@googlegroups.com> <3883c7bc-48d1-4910-bd1a-c55cb92c92bdn@googlegroups.com>
TPw2.99944@fx17.iad>
@TZUTC: -0500
@PID: Mozilla Thunderbird
@TID: FIDOGATE-5.12-ge4e8b94
On 8/28/2023 12:20 PM, Ron Shepard wrote:
> On 8/28/23 8:19 AM, gah4 wrote:
>> The second version of the Fortran standard in 1977 didn`t change much of
>> the way floating point was done, but did introduce a CHARACTER data type
>> for the first time.

> This is true regarding the floating point formats themselves, but an 
> important feature of f77 was the idea of generic functions. Before f77, 
> for example, the programmer was required to use SIN(X) for REAL argument 
> X and DSIN(X) for double precision argument X. The same was true for all 
> of the intrinsic functions ABS/DABS, SQRT/DSQRT, and so on.

> At that time, a REAL variable was likely to be any of 24-bits, 32-bits, 
> 36-bits, 48-bits, 60-bits, or 64-bits on a given compiler, so that made 
> writing portable programs, where the source code could be used 
> unchanged, difficult. If your application required, say 8 decimal digits 
> of precision, then on some machines you needed to use double precision 
> while on other machines real was sufficient. The generic functions 
> introduced with f77 helped with that portability issue.

> However, f77 did not define a generic way to specify literal constants. 
> A constant written without an exponent or with an E exponent was REAL 
> (e.g. 3.14 or 3.14E0), while a constant written with a D exponent was 
> double precision (e.g. 3.14D0).

> You will see many workarounds for these limitations in legacy code. One 
> of the common ones, which I used when applicable, was to define 
> parameter constants of the appropriate type, but to specify their values 
> with double precision literal constants.

>     parameter (PI = 3.1415926535897932384626433832795028841971D0)

> No matter how PI is defined, REAL or DOUBLE PRECISION, it always has the 
> correct value. Another common practice in legacy codes was to avoid the 
> REAL and DOUBLE PRECISION declarations and to use the nonstandard REAL*8 
> declaration instead.

>     REAL*8 PI

> Compilers would then typically map this to either REAL or DOUBLE 
> PRECISION as appropriate, meaning 48-bit, 60-bit, 64-bit, or 72-bit 
> floating point. 

or 96 bits :)



--- Mozilla Thunderbird
 * Origin: A noiseless patient Spider (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх