Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Need recursion to divide a span until less than a given value

Featured Replies

Hello all,

I need to divide the span of an opening until the span is less than a given value, each time subtracting the width of the divider.

This is somewhat similar to building a wall and putting in 2x4s until the largest gap is no larger than x. Unlike a wall though, the value isn't based on the center of the 2x4 but on the span between them.

The given parameters and example values are:

span = from 0" to 200"

maxGap = 24"

dividerWidth = 4"

So the span (200") will have one divider (4") inserted, leaving two even gaps of 98" each. One more divider will be added incrementally until the evenly sized gaps between dividers is less than the maxGap (24")

Thanks for your help!

Recursion is not necessary.

Number fields: Span, maxGap, and dividerWidth.

Calculation fields:

Divisions = If(not IsEmpty(span) and not IsEmpty(maxGap) and not IsEmpty(dividerWidth); Ceiling(span/(maxGap+dividerWidth));"")

DividerCount = Divisions - 1

Gap = (span - (dividerWidth*dividerCount))/Divisions

  • Author

Wow!

Thank you very much doughemi. That's a very complete, concise and comprehensive answer. And just what I needed.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.