Grasshopper

algorithmic modeling for Rhino

Hi all, 

I am trying to create a valid set of numbers on a single list, in a single branch. As far as I can tell, the create set component isn't working for floating point values. I can multiply the values by 100 and round them, then create a set, but it doesn't seem to work for the smaller numbers. I am sure I am missing something...

Any insights?

Thanks,

Rob

Views: 1787

Replies to This Discussion

Hi Rob,

sorting certainly won't matter, Create Set doesn't care about the order in which values are specified.

Could it be that your floating point numbers are not actually the same? When displaying floating point numbers Grasshopper rounds to 6 decimal places. These numbers typically support up to 16 decimal places and if there is a tiny difference further down they will register as different numbers.

To test the actual values of your numbers, you can use a Format component with the formatting mask {0:R}   (the 'R' stands for Roundtrip, meaning no rounding will be used and the text can be converted back into numbers without any loss of information).

If it turns out the least significant digits do indeed differ, you can round your numbers to N decimal places using an expression:

--

David Rutten

david@mcneel.com

That did it. It was a rounding error, although I am not sure how it originated. The rounding expression solved it.

Thanks for the help!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service