Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Mupp on April 01, 2021, 05:23:43 PM

Title: Round float to nearest divisible[SOLVED]
Post by: Mupp on April 01, 2021, 05:23:43 PM
I'm looking for a way to round a float to nearest divisible by X and it should work for both positive and negative floats. How can I do that?
Title: Re: Round float to nearest divisible
Post by: Alex Chouls on April 01, 2021, 06:39:43 PM
There should be actions on the ecosystem for this. Search for Float Round or Ceiling/Floor if you want to round up/down.
Title: Re: Round float to nearest divisible
Post by: Mupp on April 01, 2021, 07:24:34 PM
Thanks, I thought float round worked in a completely different way...
Title: Re: Round float to nearest divisible
Post by: Alex Chouls on April 01, 2021, 09:19:25 PM
Actually, you're right, I misread your question. Round just rounds to the nearest whole number.

What you want is a little more complicated! I'll have to get back to you after I take a look at the ecosystem...
Title: Re: Round float to nearest divisible
Post by: Alex Chouls on April 01, 2021, 09:25:40 PM
What you want is probably Float Round To Nearest (on the Ecosystem).
Title: Re: Round float to nearest divisible
Post by: Mupp on April 02, 2021, 09:30:03 AM
Got it, thanks.