# Int to real conversion - to\_real() function

**URL:** <https://discourse.mc-stan.org/t/int-to-real-conversion-to-real-function/23071>\
**Category:** Developers\
**Created:** [June 17, 2021, 1:09pm UTC](https://discourse.mc-stan.org/t/int-to-real-conversion-to-real-function/23071 "2021-06-17T13:09:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![martinmodrak](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/martinmodrak/32/133_2.png) [@martinmodrak](https://discourse.mc-stan.org/u/martinmodrak)\
**Post date:** [June 17, 2021, 1:09pm UTC](https://discourse.mc-stan.org/t/int-to-real-conversion-to-real-function/23071/1 "2021-06-17T13:09:50Z")

</div>

In the [GitHub issue for integer division](https://github.com/stan-dev/stanc3/issues/533) there was a proposal to have a `to_real` function that would convert ints to reals. It seems this never got implemented, so I am just wondering if that was intentional or if there is a preferred workaround for converting ints to reals and thus e.g. avoid warnings about division when I need a real division of values that are integer (I iterate over integers and then need fractions formed by those integers).

Tagging @nhuurre who implemented the integer division…

Thanks for any hints

---

<div class="post-metadata">

**Author:** ![nhuurre](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@nhuurre](https://discourse.mc-stan.org/u/nhuurre)\
**Post date:** [June 17, 2021, 1:35pm UTC](https://discourse.mc-stan.org/t/int-to-real-conversion-to-real-function/23071/2 "2021-06-17T13:35:23Z")

</div>

The easiest workaround is to multiply by `1.0`. As far as I known division is the only operation that does not coerce int to real automatically so I didn’t think a `to_real` was necessary.
