# Unexpected Behaviour of the Rounding Function

**URL:** https://discourse.julialang.org/t/unexpected-behaviour-of-the-rounding-function/79101
**Category:** General Usage
**Created:** [April 6, 2022, 2:02pm UTC](https://discourse.julialang.org/t/unexpected-behaviour-of-the-rounding-function/79101 "2022-04-06T14:02:08Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [April 6, 2022, 2:10pm UTC](https://discourse.julialang.org/t/unexpected-behaviour-of-the-rounding-function/79101/3 "2022-04-06T14:10:28Z")

</div>

> [@GrandlyHelping](#):
>
> `round(0.575, digits=2, RoundNearestTiesUp)`
> 
> I get 0.57, which I don’t understand. This goes for 0.565 as well for some reason.

I think that’s because the decimal value `0.575` is not exactly represented in binary floating-point arithmetic. It’s actually the value:

```julia
julia> big(0.575)
0.5749999999999999555910790149937383830547332763671875

```

which is `< 0.575`:

```julia
julia> 0.575 < 575//1000
true

```

so it correctly rounds down to `0.57`. See [PSA: floating-point arithmetic](https://discourse.julialang.org/t/psa-floating-point-arithmetic/8678)

The surprising thing to me is that `0.585` rounds up, since we also have:

```julia
julia> big(0.585)
0.58499999999999996447286321199499070644378662109375

julia> 0.585 < 585//1000
true

```

---

_[View the full topic](https://discourse.julialang.org/t/unexpected-behaviour-of-the-rounding-function/79101)._
