Previous

10.3.4.3. Real patterns



10.3.4.3.1. Syntax a) NEST real pattern{A341c ,A345a} : NEST sign mould{A342c } option, NEST variable point mould{b} or alternatively NEST floating point mould{c}.

b) NEST variable point mould{a,c} : NEST integral mould{A342b } option ; NEST point frame{A341j} , NEST integral mould{A342b } option.

c) NEST floating point mould{a} : NEST variable point mould{b} or alternatively NEST integral mould{A342b } , NEST exponent frame{A341j } , NEST integral pattern{A342a } .

d) point marker{A341j } : point{94b } symbol.

e) exponent marker{A341j } : letter e{94a } symbol. {For the Semantics of real-patterns see 10.3.4.1.2.e .}

{

aa) The modes which are output (input) compatible with a 'real' pattern are those specified by {L} REAL and {L} INT (by REF {L} REAL).

bb) A value V is converted to a string S using a 'real' pattern P as follows:

· if P contains a sign mould, the the first character of S is the sign of V; otherwise, if V < 0, the conversion is unsuccessful;

· the remainder of S contains a decimal representation of V determined as follows:

· if necessary, V is widened to a real number;

· the element of S controlled by the "." ("e") frame, if any, of P is "." ("10");

If P contains an "e" frame,
then


· let W be the sequence of frames preceding, and IP be the 'integral' pattern following, that "e" frame;

· an exponent E is calculated by standardizing V to the largest value convertible using W (see below);

· the part of S controlled by IP is obtained by converting E using IP (see 10.3.4.2.bb )

otherwise,


· let W be the whole of P;

· the element of S controlled by the "d" and "z" frames of W are the appropriate digits to be used, and the number of digits to be placed after the decimal point, if any);

· if V cannot be represented by such a string, the conversion is unsuccessful.

cc) A string S is converted to a real number suitable for a name N, using a 'real' pattern P, as follows:

· the real number R for which S contains a decimal representation is considered;

· if R is greater than the largest value to which N can refer, the conversion is unsuccessful; otherwise, R is the required real number.}
 
Next