J3/14-198
To: J3
From: Malcolm Cohen
Subject: Edits for 60559 Conformance
Date: 2014 June 19
1. Introduction
This paper contains edits for making Fortran 2015 conformant with
ISO/IEC/IEEE 60559:2011.
Early background discussion was in 13-356r1.
The specifications and syntax are in 14-196.
The specification features are all labelled with a letter. Where possible,
the edits to implement each specific feature are labelled with that letter.
2. Additional/revised syntax specification
Discussion of Specification feature (n):
This feature has two main points:
(1) read and write exact values for binary (or hexadecimal)
floating-point types.
(2) read and write in a format suitable for interchange with other
languages that follow ISO/IEC/IEEE 60559:2011; the current C
standard predates 60559:2011 but has this format (that's where
they got it from).
Corollaries:
(i) forbidding embedded blanks reduces the chance of getting a wrong
value by a misaligned read with BLANKS='ZERO';
(ii) 60559 want us to be able to output the number of mantissa digits
for exact representation; we will use ==0 to achieve that
(but this should not be allowed for decimal floating-point);
(iii) the exponent is a binary exponent i.e. two to the power of, this
means it will often be big, so we really want to use E0 to get
the minimum width here too (even if E0 is not permitted for
anything else);
(iv) for interchange purposes we absolutely do not want to permit the
omission of the exponent letter; to make EXw.d reliable this means
that EXw.d should act like EXw.dE0;
(v) I picked EX since the format begins with "0X", but EZ would perhaps
be better since we use Z format for hexadecimal integer output, or
EH might be better viz H for Hexadecimal. I have left it as EX for
now as it would be trivial to change.
Revised Syntax:
For output, new edit descriptors EXw.d and EXw.dEe.
-- w==0 for minimal field width,
-- d==0 for minimal mantissa width,
-- e==0 (or Ee omitted) for minimal exponent width.
Format according to 60559 subclause 5.12.3.
Recognise on input; exponent always required, scale factor no effect,
no embedded blanks.
Don't provide as literal constants.
3. Edits to 14-007r1/N2014
[throughout] "IEC 60559:1989" -> "ISO/IEC/IEEE 60559:2011".
{via macros \IEEEstd et al.}
[intro] describe this feature.
[247:8+] 10.3.2 Edit descriptors, R1007 ,
After "<> ES ..."
insert "<> EX . [ E ]".
[247:19] 10.3.2 Edit descriptors, C1006 " shall be positive."
replace with
"C1006 (R1011) shall be zero or positive for the EX edit
descriptor. shall be positive for all other edit
descriptors.".
[247:20] 10.3.2 Edit descriptors, C1007 " shall be zero..."
after "ES," insert "EX,".
[247:26] 10.3.2 Edit descriptors, p2,
after "ES," insert "EX,".
{feature (n).}
[251:3,6,12,18,22] 10.7.2.1 General rules, p1,
Opening sentence, after "ES," insert "EX,",
Item (1), after "not an IEEE exceptional specification"
insert "or hexadecimal-significand number",
Item (3), after "ES," insert "EX,".
Item (5), after "ES," insert "EX,",
Item (6), after "ES," insert "EX,".
{feature (n).}
[252:12] 10.7.2.3.2 F editing, p3,
"an IEEE exceptional specification or"
->"an IEEE exceptional specification, a hexadecimal-significand
number, or".
[252:31+] 10.7.2.3.2 F editing, after p6 "The value specified by 'INF'...",
Insert new paragraph
"An input field that is a hexadecimal-significand number consists of an
optional sign, followed by the hexadecimal indicator which is the
digit 0 immediately followed by the letter X, followed by a
hexadecimal significand followed by a hexadecimal exponenent. A
hexadecimal significand is a string of one or more hexadecimal
characters optionally containing a decimal symbol. The decimal symbol
indicates the position of the hexadecimal point; if no decimal symbol
appears, the hexadecimal point implicitly follows the last hexadecimal
symbol. A hexadecimal exponent is the letter P followed by a
(decimal) . Embedded blanks are not permitted in
a hexadecimal-significand number. The value is equal to the
significand multiplied by two raised to the power of the exponent,
negated if the optional sign is minus.".
{feature (n). The explicit statement of where the hexadecimal point
appears means the scale factor is ignored.}
[255:12-] Immediately before 10.7.2.3.6 Complex editing, insert
"10.7.2.3.5a EX editing
The EX. and EX. E edit descriptors indicate that the
external field occupies positions, except when is zero in which
case the processor selects the field width. The fractional part of the
field contains hexadecimal digits, except when is zero in which
case the processor selects the number of hexadecimal digits to be the
minimum required so that the output field is equal to the internal
value; shall not be zero if the radix of the internal value is not a
power of two. The hexadecimal point, represented by a decimal symbol,
appears after the first hexadecimal digit. For the form EX., and
for EX.E0, the exponent part contains the minimum number of digits
needed to represent the exponent; otherwise the exponent contains
digits. The has no effect on input. The scale factor has no effect
on output.
The form and interpretation of the input field is the same as for
F. editing (10.7.2.3.2).
For an internal value that is an IEEE infinity or NaN, the form of the
output field is the same as for F..
For an internal value that is neither an IEEE infinity nor a NaN, the
form of the output field for a scale factor of zero is
[ \plusminus ] x_0 \dot x_1 x_2 ...
where:
- \plusminus signifies a plus sign or a minus sign;
- \dot signifies a decimal symbol (10.6) indicating the hexadecimal
point;
- x_0 x_1 ... are the most significant hexadecimal digits of the
internal value, after rounding if is not zero (10.7.2.3.7);
- is a binary exponent expressed as a decimal integer; for
EX. and EX.E0, the form is P \plusminus z_1 ... z_n,
where is the minimum number of digits needed to represent ,
and for EX.E with greater than zero the form is
P \plusminus z_1 ... z_e.
The sign in the exponent is produced. A plus sign is produced if the
exponent value is zero.
NOTE 10.nn
Examples:
Internal Value Edit Descriptor Output Field
1.375 EX0.2 0X1.6P+0
-15.625 EX14.4E3 -0X1.F400P+003
1.04858e+06 EX0.0 0X1.00003P+20".
{feature (n).}
[406:9,12] 14.1 General, p4 (beginning "Additional"),
"IEEE_SQRT" -> "IEEE_SQRT, or IEEE_SUBNORMAL",
Append to paragraph
"Note that the effect of IEEE_DENORMAL is the same as that of
IEEE_SUBNORMAL."
{feature (a).}
[406:11] ditto,
"shall return true for all the"
->"shall return true for the".
{feature (c).}
OPTIONAL EXTRA EDIT:
[406:12] ditto,
after "and IEEE_DOWN"
insert
"; support for IEEE_AWAY is also required if there is at least
one kind of real X for which IEEE_SUPPORT_DATATYPE (X) is true
and RADIX (X) is equal to ten.".
{feature (c).}
[406:27+] 14.2 Derived types and constants defined in the modules, p2,
Add new bullet:
" - IEEE_MODES_TYPE is for representing the floating-point modes."
{feature (u).}
[406:32-34] 14.2 Derived types and constants defined in the modules, p3,
"_DENORMAL" -> "_SUBNORMAL", TWICE (within names),
Append
"The named constants IEEE_NEGATIVE_DENORMAL and IEEE_POSITIVE_DENORMAL
are defined with the same value as IEEE_NEGATIVE_SUBNORMAL and
IEEE_POSITIVE_SUBNORMAL respectively.".
{feature (a).}
[406:36-37] 14.2 Derived types and constants defined in the modules, p3,
"and IEEE_DOWN" -> "IEEE_DOWN, and IEEE_AWAY",
"for the IEEE modes"
->"for the rounding modes specified in ISO/IEC/IEEE
60559:2011".
{feature (c), plus reference the IEEE standard properly.}
[407:4] ditto, p4,
Between "IEEE_SQRT," and "and IEEE_UNDERFLOW_FLAG"
insert "IEE_SUBNORMAL".
{feature (a).}
[407:20] 14.3 The exceptions, p1, IEEE_INVALID bullet, append
"In a numeric relational operation $x_1$ \si{rel-op} $x_2$, if
$x_1 + x_2$ is of type real and IEEE_SUPPORT_NAN ($x_1 + x_2$)
is true, IEEE_INVALID shall signal as specified by ISO/IEC/IEEE
60559:2011 for the compareSignaling{relation} operations; that is, if
$x_1$ and $x_2$ are unordered.".
{feature (p).}
[408:23-] 14.4 The rounding modes, p1,
Insert new first paragraph
"ISO/IEC/IEEE 60559:2011 specifies a binary rounding mode that affects
floating-point arithmetic with radix 2, and a decimal rounding mode
that affects floating-point arithmetic with radix 10. Unqualified
references to the rounding mode with respect to a particular
arithmetic operation or operands refers to the mode for the radix of
the operation or operands, and other unqualified references to the
rounding mode refers to both binary and decimal rounding modes.".
{feature (t). We will try to edit all the ambiguous unqualified references
to be plural so there will be no ambiguity.}
[408:23-27+] 14.4 The rounding modes, p1,
"four rounding modes." -> "five possible modes for rounding:",
change "value." to "value;" four times,
add new bullet
"- IEEE_AWAY rounds the exact result away from zero to the
next representable value; ISO/IEC/IEEE 60559:2011
requires this mode for decimal floating-point, but it is
optional for binary floating-point.".
{feature (c). The witter is to help the reader understand why IEEE_AWAY
support is less, much less, than the other rounding modes. Also try to
differentiate the rounding mode value from the rounding mode itself, via
"possible modes for rounding"; helps with feature (t).}
[408:28-29] 14.4 The rounding modes, p2,
"rounding mode" -> "rounding modes", TWICE.
{feature (t).}
[408:30-31] 14.4 The rounding modes, p3,
"rounding mode" -> "rounding modes",
"alter it" -> "alter them".
{feature (t).}
[408:36] 14.4 The rounding modes, p4,
"rounding mode on" -> "rounding modes on",
"mode is the same as it was"->"modes are the same as they were".
{feature (t).}
[409:2] 14.5 Underflow mode, p1,
"denormalized" -> "subnormal".
{feature (a).}
[409:21] 14.7 The floating-point status, heading,
"status" -> "modes and status".
[409:22] 14.7 The floating-point status, p1,
"The values of all ... are called the floating-point status."
->"The values of the rounding mode, underflow mode, and halting
mode are collectively called the floating-point modes. The
values of all the supported flags for exceptions and the
floating-point modes are collectively called the floating-point
status. The floating-point modes can be stored in a scalar
variable of type IEEE_MODES_TYPE with the subroutine
IEEE_GET_MODES and restored with the subroutine
IEEE_SET_MODES."
{feature (u).}
[409:22] 14.7 The floating-point status, p1,
"rounding mode" -> "rounding modes".
{feature (t), this is independent from the feature (u) edit above.}
[409:25-29] 14.7 The floating-point [modes and] status, p1,
Delete "Portions of ... IEEE_SET_UNDERFLOW_MODE.".
{Delete unnecessary waffle rather than extend it with feature (u).}
[409:29+4-5] 14.7 The floating-point [modes and] status, NOTE 14.7,
"flags in a floating-point status register"
->"flags and modes in one or two status registers",
"much faster" -> "faster",
"individual flags" -> "individual flags and modes".
{Editorial: generalise this to include the modes - often not individually
settable, and water down the claim for efficiency to be more reasonable.}
[410:3,9] 14.8 Exceptional values, p1,
"Denormalized" -> "Subnormal",
"IEEE_SUPPORT_DENORMAL" -> "IEEE_SUPPORT_SUBNORMAL".
{feature (a).}
[410:31,32,34] 14.9 IEEE arithmetic, p4,
"IEEE_SUPPORT_DENORMAL" -> "IEEE_SUPPORT_SUBNORMAL",
"denormalized" -> "subnormal", THRICE.
{feature (a).}
[411:4,6] ditto, p5,
"IEEE_SUPPORT_DENORMAL" -> "IEEE_SUPPORT_SUBNORMAL",
"denormalized" -> "subnormal", TWICE.
{feature (a).}
[411:14,16] ditto, p6,
"IEEE_SUPPORT_DENORMAL" -> "IEEE_SUPPORT_SUBNORMAL",
"denormalized" -> "subnormal".
{feature (a).}
[411:33+4+] 14.10 Summary of the procedures, Table 14.1,
After line for IEEE_COPY_SIGN, add new line
"IEEE_FMA & (A, B, C) & E & Fused multiply-add operation. \\".
{feature (j).}
[411:33+5] 14.10 Summary of the procedures, Table 14.1,
IEEE_GET_ROUNDING_MODE line,
"(ROUND_VALUE)" -> "(ROUND_VALUE [, RADIX])".
{feature (t).}
[411:33+6+] 14.10 Summary of the procedures, Table 14.1,
After line for IEEE_GET_UNDERFLOW_MODE, add new line
"IEEE_INT & (A, ROUND [, KIND ]) & E & Conversion to integer type. \\".
{feature (k).}
[411:33+11+] 14.10 Summary of the procedures, Table 14.1,
After line for IEEE_LOGB, add 4 new lines
"IEEE_MAX_NUM & (X, Y) & E & Maximum numeric value. \\
IEEE_MAX_NUM_MAG & (X, Y) & E & Maximum magnitude numeric value. \\
IEEE_MIN_NUM & (X, Y) & E & Minimum numeric value. \\
IEEE_MIN_NUM_MAG & (X, Y) & E & Minimum magnitude numeric value. \\".
{feature (g).}
[411:33+12+] 14.10 Summary of the procedures, Table 14.1,
After line for IEEE_NEXT_AFTER, add 2 new lines
"IEEE_NEXT_DOWN & (X) & E & Adjacent lower machine number. \\
IEEE_NEXT_UP & (X) & E & Adjacent higher machine number. \\".
{feature (e).}
[411:33+12++] 14.10 Summary of the procedures, Table 14.1,
After previous insertion after IEEE_NEXT_AFTER, insert alphabetically
"IEEE_QUIET_EQ & (A, B) & E & Quiet compares equal. \\
IEEE_QUIET_GE & (A, B) & E & Quiet compares greater than or equal. \\
IEEE_QUIET_GT & (A, B) & E & Quiet compares greater than. \\
IEEE_QUIET_LE & (A, B) & E & Quiet compares less than or equal. \\
IEEE_QUIET_LT & (A, B) & E & Quiet compares less than. \\
IEEE_QUIET_NE & (A, B) & E & Quiet compares not equal. \\".
{feature (p).}
[411:33+12+++] 14.10 Summary of the procedures, Table 14.1,
After previous insertions after IEEE_NEXT_AFTER, insert alphabetically
"IEEE_REAL & (A [, KIND]) & E & Conversion to real type. \\".
{feature (l).}
[412:0+5] 14.10 Summary of the procedures, Table 14.1,
IEEE_SET_ROUNDING_MODE line,
"(ROUND_VALUE)" -> "(ROUND_VALUE [, RADIX])".
{feature (t).}
[412:0+6+] 14.10 Summary of the procedures, Table 14.1,
After line for IEEE_SET_UNDERFLOW_MODE, add new line
"IEEE_SIGNBIT & (X) & E & Test sign bit. \\".
{feature (r).}
[412:0+8] 14.10 Summary of the procedures, Table 14.1,
IEEE_SUPPORT_DENORMAL line,
"Query denormalized" -> "Query subnormal".
{feature (a).}
[412:0+16+] ditto, after IEEE_SUPPORT_STANDARD line, insert new line
"IEEE_SUPPORT_SUBNORMAL & ([X]) & I & Query subnormal number support.".
{feature (a).}
[412:0+lots] 14.10 Summary of the procedures, Table 14.2,
After line for IEEE_GET_HALTING_MODE insert line
"IEEE_GET_MODES & (MODES) & S & Get floating-point modes. \\",
After line for IEEE_SET_HALTING_MODE insert line
"IEEE_SET_MODES & (MODES) & S & Set floating-point modes. \\".
{feature (u).}
[413:10-12] 14.11.2 IEEE CLASS, p6 Result Value,
"_DENORMAL" -> "_SUBNORMAL" (within words), THRICE,
"denormalized" -> "subnormal".
{feature (a).}
[413:16+3] ditto, NOTE 14.10,
"denormalized" -> "subnormal".
{feature (a).}
[413:26+] Immediately before 14.11.4 IEEE_GET_FLAG, insert subclause
"14.11.3a IEEE_FMA (A, B, C)
<> Fused multiply-add operation.
<> Elemental function.
<>
A shall be of type real.
B shall be of the same type and kind type parameter as A.
C shall be of the same type and kind type parameter as A.
<> IEEE_FMA (A, B, C) shall not be invoked if
IEEE_SUPPORT_DATA_TYPE (A) has the value false.
<> Same as A.
<> The result has the value specified by ISO/IEC/IEEE
60559:2011 for the fusedMultiplyAdd operation; that is, when the result
is in range, its value is equal to the mathematical value of (A \times
B) + C rounded to the representation mode of A according to the rounding
mode. The IEEE_OVERFLOW, IEEE_UNDERFLOW, and IEEE_INEXACT shall be
signaled according to the final step in the calculation and not by any
intermediate calculation.
<> The value of IEEE_FMA(TINY(0.0), TINY(0.0), 1.0), when the
rounding mode is IEEE_NEAREST, is equal to 1.0; only the IEEE_INEXACT
exception is signaled.".
{feature (j).}
[414:29+] Immediately before 14.11.6 IEEE_GET_ROUNDING_MODE, insert
"14.11.5a IEEE_GET_MODES (MODES)
<> Get floating-point modes.
<> Subroutine.
<> MODES shall be scalar of type IEEE_MODES_TYPE. It is an
INTENT (OUT) argument that is assigned the value of the floating-point
modes.
<> To save the floating-point modes, do a calculation with
specific rounding and underflow modes, and restore them later:
USE, INTRINSIC :: IEEE_ARITHMETIC
TYPE(IEEE_MODES_TYPE) SAVE_MODES
...
CALL IEEE_GET_MODES(SAVE_MODES) ! Save all modes.
CALL IEEE_SET_ROUNDING_MODE(IEEE_TO_ZERO))
CALL IEEE_SET_UNDERFLOW_MODE(GRADUAL=.FALSE.)
... ! calculation with abrupt round-to-zero.
CALL IEEE_SET_MODES(SAVE_MODES) ! Restore all modes.".
{feature (u).}
[414:30] 14.11.6 IEEE GET ROUNDING MODE, heading,
"(ROUND_VALUE)" -> "(ROUND_VALUE [, RADIX])"/
{feature (t).}
[414:33] 14.11.6 IEEE_GET_ROUNDING_MODE, p3,
"<>" -> "<> \newline".
{feature (t).}
[414:34] 14.11.6 IEEE GET ROUNDING MODE, p3,
"or IEEE_DOWN" -> "IEEE_DOWN, or IEEE_AWAY".
{feature (c).}
[414:35+] 14.11.6 IEEE GET ROUNDING MODE, p3, insert new argument desc:
"RADIX (optional) shall be an integer scalar with the value 2 or
10. If RADIX is present with the value 10, the rounding mode
queried is the decimal rounding mode, otherwise it is the binary
rounding mode.".
{feature (t).}
[414:36] 14.11.6 IEEE GET ROUNDING MODE, p4 Example,
"store the rounding" -> "save the binary rounding".
{feature (t), plus "save" sounds better than "store".}
[415:27+] Immediately before 14.11.9 IEEE_IS_FINITE, insert subclause
"14.11.3a IEEE_INT (A, ROUND [, KIND])
<> Conversion to integer type.
<> Elemental function.
<>
A shall be of type real,
ROUND shall be of type IEEE_ROUND_TYPE.
KIND (optional) shall be a scalar integer constant expression.
<> IEEE_INT (A, ROUND, KIND) shall not be invoked if
IEEE_SUPPORT_DATA_TYPE (A) has the value false.
<> Integer. If KIND is present, the kind type
parameter is that specified by the value of KIND; otherwise, the kind
type parameter is that of default integer.
<> The result has the value specified by ISO/IEC/IEEE
60559:2011 for the convertToInteger{round} or the
convertToIntegerExact{round} operation; the processor shall consistently
choose which operation it provides. That is, the value of A is
converted to an integer according to the rounding mode specified by
ROUND; if this value is representable in the representation method of
the result, the result has this value, otherwise IEEE_INVALID is
signaled and the result is processor dependent. If the processor
provides the convertToIntegerExact operation, IEEE_INVALID did not
signal, and the value of the result differs from that of A, IEEE_INEXACT
will be signaled.
<> The value of IEEE_INT (12.5, IEEE_UP) is 13; IEEE_INEXACT
will be signaled if the processor provides the convertToIntegerExact
operation."
{feature (k).}
[415:36-37] 14.11.9 IEEE IS FINITE, p6 Result Value,
"_DENORMAL" -> "_SUBNORMAL" (within words), TWICE.
{feature (a).}
[416:18] 14.11.11 IEEE IS NEGATIVE, p6 Result Value,
"IEEE_NEGATIVE_DENORMAL" -> "IEEE_NEGATIVE_SUBNORMAL".
{feature (a).}
[417:14+] Immediately before 14.11.14 IEEE_NEXT_AFTER, insert subclauses
"14.11.13a IEEE_MAX_NUM (X, Y)
<> Maximum numeric value.
<> Elemental function.
<>
X shall be of type real.
Y shall be of the same type and kind type parameter as X.
<> IEEE_MAX_NUM shall not be invoked if
IEEE_SUPPORT_DATATYPE (X) has the value false.
<> Same as X.
<> The result has the value specified for the maxNum
operation in ISO/IEC/IEEE 60559:2011; that is,
- if X < Y the result has the value of Y;
- if Y < X the result has the value of X;
- if exactly one of X and Y is a quiet NaN the result has the value of
the other argument;
- if both X and Y are quiet NaNs the result is processor dependent;
- if one or both of X and Y are signaling NaNs, IEEE_INVALID signals and
the result is a NaN.
Except when X or Y is a signaling NaN, no exception is signaled.
<> The value of IEEE_MAX_NUM (1.5, IEEE_VALUE(IEEE_QUIET_NAN))
is 1.5.
14.11.13b IEEE_MAX_NUM_MAG (X, Y)
<> Maximum magnitude numeric value.
<> Elemental function.
<>
X shall be of type real.
Y shall be of the same type and kind type parameter as X.
<> IEEE_MAX_NUM_MAG shall not be invoked if
IEEE_SUPPORT_DATATYPE (X) has the value false.
<> Same as X.
<> The result has the value specified for the maxNumMag
operation in ISO/IEC/IEEE 60559:2011; that is,
- if ABS(X) < ABS(Y) the result has the value of Y;
- if ABS(Y) < ABS(X) the result has the value of X;
- if exactly one of X and Y is a quiet NaN the result has the value of
the other argument;
- if both X and Y are quiet NaNs the result is processor dependent;
- if one or both of X and Y are signaling NaNs, IEEE_INVALID signals and
the result is a NaN.
Except when X or Y is a signaling NaN, no exception is signaled.
<> The value of IEEE_MAX_NUM_MAG (1.5, -2.5) is -2.5.
14.11.13c IEEE_MIN_NUM (X, Y)
<> Minimum numeric value.
<> Elemental function.
<>
X shall be of type real.
Y shall be of the same type and kind type parameter as X.
<> IEEE_MIN_NUM shall not be invoked if
IEEE_SUPPORT_DATATYPE (X) has the value false.
<> Same as X.
<> The result has the value specified for the minNum
operation in ISO/IEC/IEEE 60559:2011; that is,
- if X < Y the result has the value of X;
- if Y < X the result has the value of Y;
- if exactly one of X and Y is a quiet NaN the result has the value of
the other argument;
- if both X and Y are quiet NaNs the result is processor dependent;
- if one or both of X and Y are signaling NaNs, IEEE_INVALID signals and
the result is a NaN.
Except when X or Y is a signaling NaN, no exception is signaled.
<> The value of IEEE_MIN_NUM (1.5, IEEE_VALUE(IEEE_QUIET_NAN))
is 1.5.
14.11.13d IEEE_MIN_NUM_MAG (X, Y)
<> Minimum magnitude numeric value.
<> Elemental function.
<>
X shall be of type real.
Y shall be of the same type and kind type parameter as X.
<> IEEE_MIN_NUM_MAG shall not be invoked if
IEEE_SUPPORT_DATATYPE (X) has the value false.
<> Same as X.
<> The result has the value specified for the minNumMag
operation in ISO/IEC/IEEE 60559:2011; that is,
- if ABS(X) < ABS(Y) the result has the value of X;
- if ABS(Y) < ABS(X) the result has the value of Y;
- if exactly one of X and Y is a quiet NaN the result has the value of
the other argument;
- if both X and Y are quiet NaNs the result is processor dependent;
- if one or both of X and Y are signaling NaNs, IEEE_INVALID signals and
the result is a NaN.
Except when X or Y is a signaling NaN, no exception is signaled.
<> The value of IEEE_MIN_NUM_MAG (1.5, -2.5) is 1.5.".
{feature (g).}
[417:27] 14.11.14 IEEE NEXT AFTER, p6 Result Value,
"denormalized" -> "subnormal".
{feature (a).}
[417:28+] Immediately before 14.11.15 IEEE REM, insert new subclauses.
"14.11.14a IEEE_NEXT_DOWN (X)
<> Adjacent lower machine number.
<> Elemental function.
<> X shall be of type real.
<> IEEE_NEXT_DOWN (X) shall not be invoked if
IEEE_SUPPORT_DATATYPE (X) has the value false. IEEE_NEXT_DOWN
(-HUGE(X)) shall not be invoked if IEEE_SUPPORT_INF (X) has the value
false.
<> Same as X.
<> The result has the value specified for the nextDown
operation in ISO/IEC/IEEE 60559:2011; that is, it is the greatest value
in the representation method of X that compares less than X, except when
X is equal to -infinity the result has the value -infinity, and when X
is a NaN the result is a NaN. If X is a signaling NaN, IEEE_INVALID
signals; otherwise, no exception is signaled.
<> If IEEE_SUPPORT_SUBNORMAL (0.0) is true, the value of
IEEE_NEXT_DOWN (+0.0) is the negative subnormal number with least
magnitude.
14.11.14b IEEE_NEXT_UP (X)
<> Adjacent higher machine number.
<> Elemental function.
<> X shall be of type real.
<> IEEE_NEXT_UP (X) shall not be invoked if
IEEE_SUPPORT_DATATYPE (X) has the value false. IEEE_NEXT_UP (HUGE(X))
shall not be invoked if IEEE_SUPPORT_INF (X) has the value false.
<> Same as X.
<> The result has the value specified for the nextUp
operation in ISO/IEC/IEEE 60559:2011; that is, it is the least value in
the representation method of X that compares greater than X, except when
X is equal to +infinity the result has the value +infinity, and when X
is a NaN the result is a NaN. If X is a signaling NaN,
IEEE_INVALID_signals; otherwise, no exception is signaled.
<> If IEEE_SUPPORT_INFO (X) is true, the value of IEEE_NEXT_UP
(HUGE(X)) is +infinity.".
{feature (e).}
[417:28++] Immediately before 14.11.15 IEEE_REM, after previous insertion,
insert subclauses:
"14.11.14c IEEE_QUIET_EQ (A, B)
<> Quiet compares equal.
<> Elemental function.
<>
A shall be of type real.
B shall have the same type and type parameters as A.
<> IEEE_QUIET_EQ (A) shall not be invoked if
IEEE_SUPPORT_DATATYPE (A) has the value false.
<> Default logical.
<> The result has the value specified for the
compareQuietEqual operation in ISO/IEC/IEEE 60559:2011; that is, it is
true if and only if A compares equal to B; if A or B is a NaN, the
result will be false and no exception will be signaled.
<> IEEE_QUIET_EQ (1.0, IEEE_VALUE (IEEE_QUIET_NAN)) has the
value false and no exception is signaled.
14.11.14d IEEE_QUIET_GE (A, B)
<> Quiet compares greater than or equal.
<> Elemental function.
<>
A shall be of type real.
B shall have the same type and type parameters as A.
<> IEEE_QUIET_GE (A) shall not be invoked if
IEEE_SUPPORT_DATATYPE (A) has the value false.
<> Default logical.
<> The result has the value specified for the
compareQuietGreaterEqual operation in ISO/IEC/IEEE 60559:2011; that is,
it is true if and only if A compares greater than or equal to B; if A or
B is a NaN, the result will be false and no exception will be signaled.
<> IEEE_QUIET_GE (1.0, IEEE_VALUE (IEEE_QUIET_NAN)) has the
value false and no exception is signaled.
14.11.14e IEEE_QUIET_GT (A, B)
<> Quiet compares greater than.
<> Elemental function.
<>
A shall be of type real.
B shall have the same type and type parameters as A.
<> IEEE_QUIET_GT (A) shall not be invoked if
IEEE_SUPPORT_DATATYPE (A) has the value false.
<> Default logical.
<> The result has the value specified for the
compareQuietGreater operation in ISO/IEC/IEEE 60559:2011; that is, it is
true if and only if A compares greater than B; if A or B is a NaN, the
result will be false and no exception will be signaled.
<> IEEE_QUIET_GT (1.0, IEEE_VALUE (IEEE_QUIET_NAN)) has the
value false and no exception is signaled.
14.11.14e IEEE_QUIET_LE (A, B)
<> Quiet compares less than or equal.
<> Elemental function.
<>
A shall be of type real.
B shall have the same type and type parameters as A.
<> IEEE_QUIET_LE (A) shall not be invoked if
IEEE_SUPPORT_DATATYPE (A) has the value false.
<> Default logical.
<> The result has the value specified for the
compareQuietLessEqual operation in ISO/IEC/IEEE 60559:2011; that is,
it is true if and only if A compares less than or equal to B; if A or
B is a NaN, the result will be false and no exception will be signaled.
<> IEEE_QUIET_LE (1.0, IEEE_VALUE (IEEE_QUIET_NAN)) has the
value false and no exception is signaled.
14.11.14f IEEE_QUIET_LT (A, B)
<> Quiet compares less than.
<> Elemental function.
<>
A shall be of type real.
B shall have the same type and type parameters as A.
<> IEEE_QUIET_LT (A) shall not be invoked if
IEEE_SUPPORT_DATATYPE (A) has the value false.
<> Default logical.
<> The result has the value specified for the
compareQuietLess operation in ISO/IEC/IEEE 60559:2011; that is, it is
true if and only if A compares less than B; if A or B is a NaN, the
result will be false and no exception will be signaled.
<> IEEE_QUIET_LT (1.0, IEEE_VALUE (IEEE_QUIET_NAN)) has the
value false and no exception is signaled.
14.11.14g IEEE_QUIET_NE (A, B)
<> Quiet compares not equal.
<> Elemental function.
<>
A shall be of type real.
B shall have the same type and type parameters as A.
<> IEEE_QUIET_NE (A) shall not be invoked if
IEEE_SUPPORT_DATATYPE (A) has the value false.
<> Default logical.
<> The result has the value specified for the
compareQuietLess operation in ISO/IEC/IEEE 60559:2011; that is, it is
true if and only if A compares not equal to B; if A or B is a NaN, the
result will be false and no exception will be signaled.
<> IEEE_QUIET_NE (1.0, IEEE_VALUE (IEEE_QUIET_NAN)) has the
value false and no exception is signaled.".
{feature (p).}
[417:28+++] Immediately before 14.11.15 IEEE_REM,
after previous insertions, insert subclause:
"14.11.14h IEEE_REAL (A, [, KIND])
<> Conversion to real type.
<> Elemental function.
<>
A shall be of type integer or real.
KIND (optional) shall be a scalar integer constant expression.
<> IEEE_REAL shall not be invoked if A is of type real and
IEEE_SUPPORT_DATATYPE (A) has the value false, or if KIND is present and
specifies a representation method for which IEEE_SUPPORT_DATATYPE would
have the value false.
<> Real. If KIND is present, the kind type
parameter is that specified by the value of KIND; otherwise, the kind
type parameter is that of default real.
<> The result has the same value as A if that value is
representable in the representation method of the result, and is rounded
according to the rounding mode otherwise. This shall be consistent with
the specification of ISO/IEC/IEEE 60559:2011 for the convertFromInt
operation when A is of type integer, and with the convertFormat
operation otherwise.
<> The value of IEEE_REAL(123) is 123.0.".
{feature (l).}
[418:1] 14.11.15 IEEE_REM, p6 Result Value.
Append "This function computes the remainder operation specified
in ISO/IEC/IEEE 60559:2011.".
{feature (f).}
[418:4] 14.11.16 IEEE RINT, title,
"X" -> "X [ , ROUND ]".
[418:7] ditto, p3,
"Argument. X" -> "Arguments. \newline X",
append "ROUND (optional) shall be of type IEEE_ROUND_TYPE.".
{feature (d).}
[418:10] 14.11.16 IEEE RINT, p6 Result Value,
At the beginning of the paragraph, insert
"If ROUND is present, the value of the result is the value of X
rounded to an integer according to the mode specified by
ROUND; this is the ISO/IEC/IEEE 60559:2011 operation
roundToInteger{rounding}.",
Change
"The value of the result is"
to
"Otherwise, the value of the result is that specified for the
operation roundIntegralToExact in ISO/IEC/IEEE 60559:2011; this
is".
{feature (b) and (d).}
[418:12-13] ditto, p7 Examples,
"If the rounding mode is round up, the" -> "The",
"IEEE_RINT (1.1)" -> "IEEE_RINT (1.1, IEEE_UP)".
{feature (d).}
[420:3-] Immediately before 14.11.21 IEEE_SET_ROUNDING_MODE, insert
"14.11.20a IEEE_SET_MODES (MODES)
<> Set floating-point modes.
<> Subroutine.
<> MODES shall be scalar of type IEEE_MODES_TYPE. Its value
shall be one that was assigned by a previous invocation of
IEEE_GET_MODES to its MODES argument. The floating-point modes (14.7)
are restored to the state at that invocation.
<> To save the floating-point modes, do a calculation with
specific rounding and underflow modes, and restore them later:
USE, INTRINSIC :: IEEE_ARITHMETIC
TYPE(IEEE_MODES_TYPE) SAVE_MODES
...
CALL IEEE_GET_MODES(SAVE_MODES) ! Save all modes.
CALL IEEE_SET_ROUNDING_MODE(IEEE_TO_ZERO))
CALL IEEE_SET_UNDERFLOW_MODE(GRADUAL=.FALSE.)
... ! calculation with abrupt round-to-zero.
CALL IEEE_SET_MODES(SAVE_MODES) ! Restore all modes.".
{feature (u).}
[420:3,4,6,7+,10,11] 14.11.21 IEEE SET ROUNDING MODE, heading to p5,
"(ROUND_VALUE)" -> "(ROUND_VALUE [, RADIX])",
"Set IEEE" -> "Set",
"<>" -> "<> \newline",
append new argument description
"RADIX (optional) shall be an integer scalar with
the value 2 or 10. If RADIX is present with the
value 10, the rounding mode set is the decimal
rounding mode, otherwise it is the binary rounding
mode.",
append new restriction
"IEEE_SET_ROUNDING_MODE (ROUND_VALUE, RADIX) shall
not be invoked unless IEEE_SUPPORT_ROUNDING
(ROUND_VALUE, X) is true for some X with radix
RADIX such that IEEE_SUPPORT_DATATYPE (X) is
true.",
"store the rounding" -> "save the binary rounding".
{feature (t) plus fix typo in Description plus improve Example wording.}
[421:15+] Immediately before 14.11.24 IEEE_SUPPORT_DATATYPE, new subclause:
"14.11.23a IEEE_SIGNBIT (X)
<> Test sign bit.
<> Elemental function.
<> X shall be of type real.
<> IEEE_SIGNBIT (X) shall not be invoked if
IEEE_SUPPORT_DATATYPE (X) has the value false.
<> Default logical.
<> The result has the value specified for the
isSignMinus operation in ISO/IEC/IEEE 60559:2011; that is, it is
true if and only if the sign bit of X is nonzero. No exception
is signaled even if X is a signaling NaN.
<> IEEE_SIGNBIT (-1.0) has the value true.".
{feature (r).}
[421:25] 14.11.24 IEEE SUPPORT DATATYPE, p6 Example,
"denormalized" -> "subnormal".
{feature (a).}
[421:33] 14.11.25 IEEE SUPPORT DENORMAL, p5 Result Value, Case (i),
"denormalized" -> "subnormal",
[422:5-6] ditto, p6 Example,
"denormalized numbers" -> "subnormal values".
{feature (a), plus "values" works better than "numbers" here.}
[422:6+2,5] ditto, NOTE 14.13,
"denormalized" -> "subnormal", TWICE.
{feature (a).}
[425:11-15] 14.11.34 IEEE SUPPORT STANDARD, p5 Result Value, Case (i),
Delete "IEEE_SUPPORT_DENORMAL (X),",
"and IEEE_SUPPORT_SQRT"
->", IEEE_SUPPORT_SQRT (X), and IEEE_SUPPORT_SUBNORMAL".
{feature (a).}
[425:19+] Immediately before 14.11.35 IEEE SUPPORT UNDERFLOW CONTROL,
insert new subclause that is a copy of 14.11.25
IEEE_SUPPORT_DENORMAL, with DENORMAL changed to SUBNORMAL
(within words) throughout (including the title).
{feature (a).}
[426:14] 14.11.37 IEEE VALUE, p3 Arguments, CLASS argument,
"DENORMAL" -> "SUBNORMAL" (within words), THRICE.
{feature (a).}
[483:22] A.2,
"the initial rounding mode" -> "the initial rounding modes".
{feature (t).}
=====================================
(n) Provide convert{From,To}HexCharacter operations.
Specification feature (n):
For output, new edit descriptors EXw.d and EXw.dEe. Format according
to 60559 subclause 5.12.3. Recognise on input. Don't provide as
literal constants.
===END===