You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: standard/expressions.md
+19-19Lines changed: 19 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3609,9 +3609,9 @@ For an operation of the form `-x`, unary operator overload resolution ([§12.4.
3609
3609
- Integer negation:
3610
3610
3611
3611
```csharp
3612
-
intoperator–(intx);
3613
-
nintoperator–(nintx);
3614
-
longoperator–(longx);
3612
+
intoperator-(intx);
3613
+
nintoperator-(nintx);
3614
+
longoperator-(longx);
3615
3615
```
3616
3616
3617
3617
The result is computed by subtracting `X` from zero. If the value of `X` is the smallest representable value of the operand type (−2³¹ for `int`, the corresponding value for `nint`, or −2⁶³ for `long`), then the mathematical negation of `X` is not representable within the operand type. If this occurs within a `checked` context, a `System.OverflowException` is thrown; if it occurs within an `unchecked` context, the result is the value of the operand and the overflow is not reported.
@@ -3624,15 +3624,15 @@ For an operation of the form `-x`, unary operator overload resolution ([§12.4.
3624
3624
- Floating-point negation:
3625
3625
3626
3626
```csharp
3627
-
floatoperator–(floatx);
3628
-
doubleoperator–(doublex);
3627
+
floatoperator-(floatx);
3628
+
doubleoperator-(doublex);
3629
3629
```
3630
3630
3631
3631
The result is the value of `X` with its sign inverted. If `x` is `NaN`, the result is also `NaN`.
3632
3632
- Decimal negation:
3633
3633
3634
3634
```csharp
3635
-
decimaloperator–(decimalx);
3635
+
decimaloperator-(decimalx);
3636
3636
```
3637
3637
3638
3638
The result is computed by subtracting `X` from zero. Decimal negation is equivalent to using the unary minus operator of type `System.Decimal`.
@@ -4221,20 +4221,20 @@ The predefined subtraction operators are listed below. The operators all subtrac
4221
4221
- Integer subtraction:
4222
4222
4223
4223
```csharp
4224
-
intoperator–(intx, inty);
4225
-
uintoperator–(uintx, uinty);
4226
-
nintoperator–(nintx, ninty);
4227
-
nuintoperator–(nuintx, nuinty);
4228
-
longoperator–(longx, longy);
4229
-
ulongoperator–(ulongx, ulongy);
4224
+
intoperator-(intx, inty);
4225
+
uintoperator-(uintx, uinty);
4226
+
nintoperator-(nintx, ninty);
4227
+
nuintoperator-(nuintx, nuinty);
4228
+
longoperator-(longx, longy);
4229
+
ulongoperator-(ulongx, ulongy);
4230
4230
```
4231
4231
4232
4232
In a `checked` context, if the difference is outside the range of the result type, a `System.OverflowException` is thrown. In an `unchecked` context, overflows are not reported and any significant high-order bits outside the range of the result type are discarded.
4233
4233
- Floating-point subtraction:
4234
4234
4235
4235
```csharp
4236
-
floatoperator–(floatx, floaty);
4237
-
doubleoperator–(doublex, doubley);
4236
+
floatoperator-(floatx, floaty);
4237
+
doubleoperator-(doublex, doubley);
4238
4238
```
4239
4239
4240
4240
The difference is computed according to the rules of IEC 60559 arithmetic. The following table lists the results of all possible combinations of nonzero finite values, zeros, infinities, and NaNs. In the table, `x` and `y` are nonzero finite values, and `z` is the result of `x – y`. If `x` and `y` are equal, `z` is positive zero. If `x – y` is too large to represent in the destination type, `z` is an infinity with the same sign as `x – y`.
@@ -4252,7 +4252,7 @@ The predefined subtraction operators are listed below. The operators all subtrac
4252
4252
- Decimal subtraction:
4253
4253
4254
4254
```csharp
4255
-
decimaloperator–(decimalx, decimaly);
4255
+
decimaloperator-(decimalx, decimaly);
4256
4256
```
4257
4257
4258
4258
If the magnitude of the resulting value is too large to represent in the decimal format, a `System.OverflowException` is thrown. The scale of the result, before any rounding, is the larger of the scales of the two operands.
@@ -4262,21 +4262,21 @@ The predefined subtraction operators are listed below. The operators all subtrac
4262
4262
- Enumeration subtraction. Every enumeration type implicitly provides the following predefined operator, where `E` is the enum type, and `U` is the underlying type of `E`:
4263
4263
4264
4264
```csharp
4265
-
Uoperator–(Ex, Ey);
4265
+
Uoperator-(Ex, Ey);
4266
4266
```
4267
4267
4268
4268
This operator is evaluated exactly as `(U)((U)x – (U)y)`. In other words, the operator computes the difference between the ordinal values of `x` and `y`, and the type of the result is the underlying type of the enumeration.
4269
4269
4270
4270
```csharp
4271
-
Eoperator–(Ex, Uy);
4271
+
Eoperator-(Ex, Uy);
4272
4272
```
4273
4273
4274
4274
This operator is evaluated exactly as `(E)((U)x – y)`. In other words, the operator subtracts a value from the underlying type of the enumeration, yielding a value of the enumeration.
4275
4275
4276
4276
- Delegate removal. Every delegate type implicitly provides the following predefined operator, where `D` is the delegate type:
4277
4277
4278
4278
```csharp
4279
-
Doperator–(Dx, Dy);
4279
+
Doperator-(Dx, Dy);
4280
4280
```
4281
4281
4282
4282
The semantics are as follows:
@@ -4529,7 +4529,7 @@ If either operand is NaN, the result is `false` for all operators except `!=`,
4529
4529
When neither operand is NaN, the operators compare the values of the two floating-point operands with respect to the ordering
4530
4530
4531
4531
```csharp
4532
-
–∞ <–max<... <–min<–0.0==+0.0<+min<... <+max<+∞
4532
+
-∞ <-max<... <-min<-0.0==+0.0<+min<... <+max<+∞
4533
4533
```
4534
4534
4535
4535
where `min` and `max` are the smallest and largest positive finite values that can be represented in the given floating-point format. Notable effects of this ordering are:
0 commit comments