# Round function Perspective

**URL:** <https://forum.inductiveautomation.com/t/round-function-perspective/76076>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [July 7, 2023, 6:35pm UTC](https://forum.inductiveautomation.com/t/round-function-perspective/76076 "2023-07-07T18:35:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josue\_Cuadras](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/josue_cuadras/32/59915_2.png) [@Josue\_Cuadras](https://forum.inductiveautomation.com/u/Josue_Cuadras)\
**Post date:** [July 7, 2023, 6:35pm UTC](https://forum.inductiveautomation.com/t/round-function-perspective/76076/1 "2023-07-07T18:35:29Z")

</div>

Hello, in ignition I want to round a number until it is close to 0.8, that is, if I have the value of 2.7 it is rounded to 2 and if the value is 2.8 it is rounded to 3, is there an expression to achieve this?

I have used the floor function but it does not achieve what I describe.

Thanks in advanced.

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [July 7, 2023, 6:55pm UTC](https://forum.inductiveautomation.com/t/round-function-perspective/76076/2 "2023-07-07T18:55:32Z")

</div>

See if this does what you want. I am sure there is probably another better way to do it.

```auto
if(round({value}%1,1) >= .8, {value}-{value}%1+1, {value}-{value}%1)

```

Edit: fixed the round down part.

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [July 7, 2023, 7:00pm UTC](https://forum.inductiveautomation.com/t/round-function-perspective/76076/3 "2023-07-07T19:00:42Z")

</div>

> [@josborn](#):
>
> `if(round({value}%1,1) >= .8, {value}-{value}%1+1, {value})`

To slightly tweak this:

```auto
if(round({value}%1,1)<.8, floor({value}),ceil({value}))

```

or really even

```auto
if({value}%1<.8, floor({value}),ceil({value}))

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 7, 2023, 7:08pm UTC](https://forum.inductiveautomation.com/t/round-function-perspective/76076/4 "2023-07-07T19:08:28Z")

</div>

`floor({value}+0.2)`

---

<div class="post-metadata">

**Author:** ![Josue\_Cuadras](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/josue_cuadras/32/59915_2.png) [@Josue\_Cuadras](https://forum.inductiveautomation.com/u/Josue_Cuadras)\
**Post date:** [July 7, 2023, 7:33pm UTC](https://forum.inductiveautomation.com/t/round-function-perspective/76076/5 "2023-07-07T19:33:41Z")

</div>

Thanks to everyone!

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [July 7, 2023, 8:12pm UTC](https://forum.inductiveautomation.com/t/round-function-perspective/76076/6 "2023-07-07T20:12:26Z")

</div>

As usual, @paul-griffith is the best golfer. 🏌️‍♂️
