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
@@ -3612,9 +3612,9 @@ For an operation of the form `-x`, unary operator overload resolution ([§12.4.
3612
3612
- Integer negation:
3613
3613
3614
3614
```csharp
3615
-
intoperator–(intx);
3616
-
nintoperator–(nintx);
3617
-
longoperator–(longx);
3615
+
intoperator-(intx);
3616
+
nintoperator-(nintx);
3617
+
longoperator-(longx);
3618
3618
```
3619
3619
3620
3620
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.
@@ -3627,15 +3627,15 @@ For an operation of the form `-x`, unary operator overload resolution ([§12.4.
3627
3627
- Floating-point negation:
3628
3628
3629
3629
```csharp
3630
-
floatoperator–(floatx);
3631
-
doubleoperator–(doublex);
3630
+
floatoperator-(floatx);
3631
+
doubleoperator-(doublex);
3632
3632
```
3633
3633
3634
3634
The result is the value of `X` with its sign inverted. If `x` is `NaN`, the result is also `NaN`.
3635
3635
- Decimal negation:
3636
3636
3637
3637
```csharp
3638
-
decimaloperator–(decimalx);
3638
+
decimaloperator-(decimalx);
3639
3639
```
3640
3640
3641
3641
The result is computed by subtracting `X` from zero. Decimal negation is equivalent to using the unary minus operator of type `System.Decimal`.
@@ -4229,20 +4229,20 @@ The predefined subtraction operators are listed below. The operators all subtrac
4229
4229
- Integer subtraction:
4230
4230
4231
4231
```csharp
4232
-
intoperator–(intx, inty);
4233
-
uintoperator–(uintx, uinty);
4234
-
nintoperator–(nintx, ninty);
4235
-
nuintoperator–(nuintx, nuinty);
4236
-
longoperator–(longx, longy);
4237
-
ulongoperator–(ulongx, ulongy);
4232
+
intoperator-(intx, inty);
4233
+
uintoperator-(uintx, uinty);
4234
+
nintoperator-(nintx, ninty);
4235
+
nuintoperator-(nuintx, nuinty);
4236
+
longoperator-(longx, longy);
4237
+
ulongoperator-(ulongx, ulongy);
4238
4238
```
4239
4239
4240
4240
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.
4241
4241
- Floating-point subtraction:
4242
4242
4243
4243
```csharp
4244
-
floatoperator–(floatx, floaty);
4245
-
doubleoperator–(doublex, doubley);
4244
+
floatoperator-(floatx, floaty);
4245
+
doubleoperator-(doublex, doubley);
4246
4246
```
4247
4247
4248
4248
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`.
@@ -4260,7 +4260,7 @@ The predefined subtraction operators are listed below. The operators all subtrac
4260
4260
- Decimal subtraction:
4261
4261
4262
4262
```csharp
4263
-
decimaloperator–(decimalx, decimaly);
4263
+
decimaloperator-(decimalx, decimaly);
4264
4264
```
4265
4265
4266
4266
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.
@@ -4270,21 +4270,21 @@ The predefined subtraction operators are listed below. The operators all subtrac
4270
4270
- 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`:
4271
4271
4272
4272
```csharp
4273
-
Uoperator–(Ex, Ey);
4273
+
Uoperator-(Ex, Ey);
4274
4274
```
4275
4275
4276
4276
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.
4277
4277
4278
4278
```csharp
4279
-
Eoperator–(Ex, Uy);
4279
+
Eoperator-(Ex, Uy);
4280
4280
```
4281
4281
4282
4282
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.
4283
4283
4284
4284
- Delegate removal. Every delegate type implicitly provides the following predefined operator, where `D` is the delegate type:
4285
4285
4286
4286
```csharp
4287
-
Doperator–(Dx, Dy);
4287
+
Doperator-(Dx, Dy);
4288
4288
```
4289
4289
4290
4290
The semantics are as follows:
@@ -4540,7 +4540,7 @@ If either operand is NaN, the result is `false` for all operators except `!=`,
4540
4540
When neither operand is NaN, the operators compare the values of the two floating-point operands with respect to the ordering
4541
4541
4542
4542
```csharp
4543
-
–∞ <–max<... <–min<–0.0==+0.0<+min<... <+max<+∞
4543
+
-∞ <-max<... <-min<-0.0==+0.0<+min<... <+max<+∞
4544
4544
```
4545
4545
4546
4546
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