Question: ```
1.824999999999999.round(2)
# => 1.82
1.82499999999999999.round(2)
# => 1.83

```

I don't understand why the result in the first case is `1.82` and for the latter `1.83`. My desired result is `1.82` for both cases.

Answer: 
As is well known, a floating number in computer has errors. Notice that both numbers that you have are close to `1.825`. In your first case, the number is small enough to be differentiated from `1.825`.

```
1.824999999999999
# => 1.824999999999999

```

In your second case, having enough `9`s makes the value close enough to be considered exactly as `1.825`:

```
1.82499999999999999
# => 1.825

```

Then, when you apply `round`, you get `1.83`.
In addition to the many excellent explanations here, I'd like to give an example using `BigDecimal`

```
o = BigDecimal.new('1.82499999999999999', 17)
2.0.0p247 :011 > o.round(2).to_f
 => 1.82

```

Also notice that `#round` takes various modes for rounding, as per the docs.

Ref:

1. <http://www.ruby-doc.org/stdlib-2.1.0/libdoc/bigdecimal/rdoc/BigDecimal.html#method-c-mode>
2. <http://www.ruby-doc.org/stdlib-2.1.0/libdoc/bigdecimal/rdoc/BigDecimal.html#method-i-round>