Skip to content

Commit

Permalink
Correct the reference with regards to floats
Browse files Browse the repository at this point in the history
Fixes #19595.
  • Loading branch information
steveklabnik committed Dec 7, 2014
1 parent f7d18b9 commit 131f202
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/doc/reference.md
Expand Up @@ -496,9 +496,8 @@ Examples of integer literals of various forms:

A _floating-point literal_ has one of two forms:

* Two _decimal literals_ separated by a period
character `U+002E` (`.`), with an optional _exponent_ trailing after the
second decimal literal.
* A _decimal literal_ followed by a period character `U+002E` (`.`). This is
optionally followed by another decimal literal, with an optional _exponent_.
* A single _decimal literal_ followed by an _exponent_.

By default, a floating-point literal has a generic type, and, like integer
Expand All @@ -509,12 +508,17 @@ types), which explicitly determine the type of the literal.
Examples of floating-point literals of various forms:

```
123.0f64; // type f64
0.1f64; // type f64
0.1f32; // type f32
12E+99_f64; // type f64
123.0f64; // type f64
0.1f64; // type f64
0.1f32; // type f32
12E+99_f64; // type f64
let x: f64 = 2.; // type f64
```

This last example is different because it is not possible to use the suffix
syntax with a floating point literal ending in a period. `2.f64` would attempt
to call a method named `f64` on `2`.

##### Boolean literals

The two values of the boolean type are written `true` and `false`.
Expand Down

0 comments on commit 131f202

Please sign in to comment.