# How to convert "rational" to "float"?

**URL:** <https://forums.unrealengine.com/t/how-to-convert-rational-to-float/2332765>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [February 14, 2025, 5:05pm UTC](https://forums.unrealengine.com/t/how-to-convert-rational-to-float/2332765 "2025-02-14T17:05:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shoka](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shoka/32/1169404_2.png) [@Shoka](https://forums.unrealengine.com/u/Shoka)\
**Post date:** [February 14, 2025, 5:05pm UTC](https://forums.unrealengine.com/t/how-to-convert-rational-to-float/2332765/1 "2025-02-14T17:05:33Z")

</div>

I need the result of a division between an INT and a FLOAT to be a FLOAT, but it turns into a RATIONAL, and I can’t find a way to convert it into a FLOAT.

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [February 14, 2025, 7:28pm UTC](https://forums.unrealengine.com/t/how-to-convert-rational-to-float/2332765/2 "2025-02-14T19:28:09Z")

</div>

Could you try this? (Changing the 99’s while Keeping the \*1.0 intact)

```auto
MyNumber:float=99*1.0/99.0

```

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [February 14, 2025, 7:56pm UTC](https://forums.unrealengine.com/t/how-to-convert-rational-to-float/2332765/4 "2025-02-14T19:56:07Z")

</div>

Variables aren’t unknown since you always have to pre-write what type it is either in the parameters of a function or when declaring it, do you have an example of a function maybe in the code where it doesn’t work?

---

<div class="post-metadata">

**Author:** ![Shoka](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shoka/32/1169404_2.png) [@Shoka](https://forums.unrealengine.com/u/Shoka)\
**Post date:** [February 14, 2025, 8:08pm UTC](https://forums.unrealengine.com/t/how-to-convert-rational-to-float/2332765/5 "2025-02-14T20:08:17Z")

</div>

OOOOH sorry I get it now, you are right, thank you!  
The example was really good but I will leave this here in case someone is slow like me, it helped me understand a little better:

X : float = Y \* 1.0 / Z

X - Your variable (a float that will receive the expression result)  
Y - Your integer number  
Z - Your float number

- Make sure to put .0 or .f64 as sufix for floats when declaring them

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [February 14, 2025, 8:19pm UTC](https://forums.unrealengine.com/t/how-to-convert-rational-to-float/2332765/6 "2025-02-14T20:19:59Z")

</div>

> [@Shoka](#):
>
> or .f64 as sufix

whats .f64?

---

<div class="post-metadata">

**Author:** ![Shoka](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shoka/32/1169404_2.png) [@Shoka](https://forums.unrealengine.com/u/Shoka)\
**Post date:** [February 14, 2025, 8:22pm UTC](https://forums.unrealengine.com/t/how-to-convert-rational-to-float/2332765/7 "2025-02-14T20:22:34Z")

</div>

It’s a way to declare floats if you don’t want to type the decimal  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/e/1/9e15111dd8cdd9ffe7da875d0ac9df6c6279cd1f.png)  
I found it by mistake trying to declare floats like in other languages (1f, 0.5f etc)

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [March 16, 2025, 8:22pm UTC](https://forums.unrealengine.com/t/how-to-convert-rational-to-float/2332765/8 "2025-03-16T20:22:36Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
