Grasshopper

algorithmic modeling for Rhino

Is there a more elegant way to get the integer part of a positive number, making sure the result is bigger than the initial number.
ex : number=10.2 would give "11"

Rounding off to the superior value is very common when you calculate the sections of a steel structure for instance...

Views: 224

Replies to This Discussion

Try using the Ceiling(x) command inside a function component. This will return the smallest integer that is greater than or equal to the variable x. So, in your example where x = 10.2, then 11 would be the smallest integer that is greater than 10.2. Hope that helps.
Additionally, the Floor(x) command will return the greatest integer that is less than or equal to the variable x. You can think of these as a "Round Up" or "Round Down" function to the nearest integer.
Ahhh !!! Of course !
Thanks Andy.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service