Sujet : Re: Simple Pascal question
De : arne (at) *nospam* vajhoej.dk (Arne Vajhøj)
Groupes : comp.os.vmsDate : 03. Aug 2024, 19:40:32
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v8ltiv$3i5h9$2@dont-email.me>
References : 1 2 3
User-Agent : Mozilla Thunderbird
On 8/3/2024 1:32 PM, Scott Dorsey wrote:
In article <v8hn3m$3aviu$1@gwaiyur.mb-net.net>,
Uli Bellgardt <UliBellgardtsSpamSink@online.de> wrote:
The value 1.5 should be an f_float value as well:
>
$ type zzz.pas
program z(input,output);
>
var
x : f_float;
This seems very strange to me... Pascal isn't supposed to have such
strong typing, is it? I don't remember ever having to manually coerce
anything. Or is f_float sufficiently different from a normal float?
The intended way in Pascal is to use real and double and
let compiler switch determine implementation.
/float=d_f -> F & D
/float=g_f -> F & G
/float=ieee -> S & T
But Pascal also allows for being more explicit.
To quote from the manual:
<quote>
VSI Pascal provides the following built-in data types to declare variables of a specific floating point type regardless of the /FLOAT setting on the command line (or FLOAT attribute on the MODULE):
F_FLOAT
D_FLOAT
G_FLOAT
S_FLOAT
T_FLOAT
X_FLOAT
</quote>
And I "forgot" to read a half page ahead and find:
<quote>
The floating lexical functions %F_FLOAT, %D_FLOAT, %G_FLOAT, %S_FLOAT, and %T_FLOAT can be prefixed on a floating constant to select the floating type regardless of any module-level attribute or command line selection.
</quote>
Arne