Commit e28ccebd authored by Robert Griesemer's avatar Robert Griesemer

- simplified the ideal number terminology for better readability

R=r
DELTA=24  (0 added, 10 deleted, 14 changed)
OCL=15188
CL=15188
parent ad711106
...@@ -765,15 +765,15 @@ long. Similarly, float is at least 32 bits, double is at least 64 ...@@ -765,15 +765,15 @@ long. Similarly, float is at least 32 bits, double is at least 64
bits, and the sizes have float <= double. bits, and the sizes have float <= double.
byte alias for uint8 byte alias for uint8
ushort uint16 <= ushort <= uint ushort uint16 <= ushort <= uint
uint uint32 <= uint <= ulong uint uint32 <= uint <= ulong
ulong uint64 <= ulong ulong uint64 <= ulong
short int16 <= short <= int short int16 <= short <= int
int int32 <= int <= long int int32 <= int <= long
long int64 <= long long int64 <= long
float float32 <= float <= double float float32 <= float <= double
double float64 <= double double float64 <= double
An arithmetic type ``ptrint'' is also defined. It is an unsigned An arithmetic type ``ptrint'' is also defined. It is an unsigned
...@@ -783,16 +783,6 @@ large enough to store the uninterpreted bits of a pointer value. ...@@ -783,16 +783,6 @@ large enough to store the uninterpreted bits of a pointer value.
Generally, programmers should use these types rather than the explicitly Generally, programmers should use these types rather than the explicitly
sized types to maximize portability. sized types to maximize portability.
Finally, for the purpose of explaining the rules of expressions (§Expressions),
there are three ideal numeric types:
'ideal int' the set of all ideal ints
'ideal float' the set of all ideal floats
'ideal number' the union of ideal_int and ideal_float
The type of an integer or character literal is "ideal_int"
and the type of a floating point literal is "ideal_float".
Booleans Booleans
---- ----
...@@ -1176,13 +1166,13 @@ An expression specifies the computation of a value via the application of ...@@ -1176,13 +1166,13 @@ An expression specifies the computation of a value via the application of
operators and function invocations on operands. An expression has a value and operators and function invocations on operands. An expression has a value and
a type. a type.
An expression may be of ideal numeric type. The type of such expressions is The type of an expression may be an ideal number. The type of such expressions
implicitly converted into the 'expected type' required for the expression. is implicitly converted into the 'expected type' required for the expression.
The conversion is legal if the (ideal) expression value is a member of the The conversion is legal if the (ideal) expression value is a member of the
set represented by the expected type. Otherwise the expression is erroneous. set represented by the expected type. Otherwise the expression is erroneous.
For instance, if the expected type is int32, any ideal_int or ideal_float For instance, if the expected type is int32, any ideal number
value which fits into an int32 without loss of precision can be legally converted. which fits into an int32 without loss of precision can be legally converted.
Along the same lines, a negative ideal integer cannot be converted into a uint Along the same lines, a negative ideal integer cannot be converted into a uint
without loss of the sign; such a conversion is illegal. without loss of the sign; such a conversion is illegal.
...@@ -1438,13 +1428,13 @@ Operators combine operands into expressions. ...@@ -1438,13 +1428,13 @@ Operators combine operands into expressions.
The operand types in binary operations must be equal, with the following exceptions: The operand types in binary operations must be equal, with the following exceptions:
- The right operand in a shift operation must be - The right operand in a shift operation must be
an unsigned int type (§Arithmetic operators). an unsigned int (§Arithmetic operators).
- Otherwise, an operand of ideal_number type is - Otherwise, ideal number operands are
converted into the type of the other operand (§Expression). converted to match the type of the other operand (§Expression).
- If both operands are ideal numbers, the conversion is to ideal_float - If both operands are ideal numbers, the conversion is to ideal floats
if one of the operand types is ideal_float (relevant for "/" and "%"). if one of the operands is an ideal float (relevant for "/" and "%").
Unary operators have the highest precedence. Unary operators have the highest precedence.
There are six precedence levels for binary operators: There are six precedence levels for binary operators:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment