playMaker

Author Topic: Round float to nearest divisible[SOLVED]  (Read 850 times)

Mupp

  • Full Member
  • ***
  • Posts: 167
Round float to nearest divisible[SOLVED]
« 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?
« Last Edit: April 08, 2021, 04:26:38 AM by jeanfabre »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4002
  • Official Playmaker Support
    • LinkedIn
Re: Round float to nearest divisible
« Reply #1 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.

Mupp

  • Full Member
  • ***
  • Posts: 167
Re: Round float to nearest divisible
« Reply #2 on: April 01, 2021, 07:24:34 PM »
Thanks, I thought float round worked in a completely different way...

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4002
  • Official Playmaker Support
    • LinkedIn
Re: Round float to nearest divisible
« Reply #3 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...

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4002
  • Official Playmaker Support
    • LinkedIn
Re: Round float to nearest divisible
« Reply #4 on: April 01, 2021, 09:25:40 PM »
What you want is probably Float Round To Nearest (on the Ecosystem).

Mupp

  • Full Member
  • ***
  • Posts: 167
Re: Round float to nearest divisible
« Reply #5 on: April 02, 2021, 09:30:03 AM »
Got it, thanks.