File tree 1 file changed +11
-7
lines changed
1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -496,9 +496,8 @@ Examples of integer literals of various forms:
496
496
497
497
A _ floating-point literal_ has one of two forms:
498
498
499
- * Two _ decimal literals_ separated by a period
500
- character ` U+002E ` (` . ` ), with an optional _ exponent_ trailing after the
501
- second decimal literal.
499
+ * A _ decimal literal_ followed by a period character ` U+002E ` (` . ` ). This is
500
+ optionally followed by another decimal literal, with an optional _ exponent_ .
502
501
* A single _ decimal literal_ followed by an _ exponent_ .
503
502
504
503
By default, a floating-point literal has a generic type, and, like integer
@@ -509,12 +508,17 @@ types), which explicitly determine the type of the literal.
509
508
Examples of floating-point literals of various forms:
510
509
511
510
```
512
- 123.0f64; // type f64
513
- 0.1f64; // type f64
514
- 0.1f32; // type f32
515
- 12E+99_f64; // type f64
511
+ 123.0f64; // type f64
512
+ 0.1f64; // type f64
513
+ 0.1f32; // type f32
514
+ 12E+99_f64; // type f64
515
+ let x: f64 = 2.; // type f64
516
516
```
517
517
518
+ This last example is different because it is not possible to use the suffix
519
+ syntax with a floating point literal ending in a period. ` 2.f64 ` would attempt
520
+ to call a method named ` f64 ` on ` 2 ` .
521
+
518
522
##### Boolean literals
519
523
520
524
The two values of the boolean type are written ` true ` and ` false ` .
You can’t perform that action at this time.
0 commit comments