# Bug in Julia rational array inplace multiplication

**URL:** https://discourse.julialang.org/t/bug-in-julia-rational-array-inplace-multiplication/37446
**Category:** General Usage
**Created:** [April 12, 2020, 12:55pm UTC](https://discourse.julialang.org/t/bug-in-julia-rational-array-inplace-multiplication/37446 "2020-04-12T12:55:52Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [April 12, 2020, 1:21pm UTC](https://discourse.julialang.org/t/bug-in-julia-rational-array-inplace-multiplication/37446/5 "2020-04-12T13:21:17Z")

</div>

To expand on what @DNF said, what’s happening is

```julia
julia> Rational(1//1 * (1/5))
3602879701896397//18014398509481984

```

which happens to be correct (although somewhat unexpected if you are not aware of how floating point works). Cf

> [@PSA: floating-point arithmetic](https://discourse.julialang.org/t/psa-floating-point-arithmetic/8678):
>
> Sometimes people are surprised by the results of floating-point calculations such as julia\> 5/6 0.8333333333333334 # shouldn't the last digit be 3? julia\> 2.6 - 0.7 - 1.9 2.220446049250313e-16 # shouldn't the answer be 0? These are not bugs in Julia. They’re consequences of the IEEE-standard 64-bit binary representation of floating-point numbers that is burned into computer hardware, which Julia and many other languages use by default. Brief explanation You can t…

---

_[View the full topic](https://discourse.julialang.org/t/bug-in-julia-rational-array-inplace-multiplication/37446)._
