Grasshopper

algorithmic modeling for Rhino

Error Factorial component doesn't go above integer 12

Hi,

 

Perhaps this is a bug or perhaps the factorial function doesn't go above integer 12?

When I run the following I get an error at 13.

 

I also crashed rhino adjusting the slider.

 

I'd like the factorial component to go to higher factorials/permutations just to determine easily permutations. For instance I have 30 tile colors and I wanted to see their permutations quickly, I realize I can use 30*29*28 etc but I thought I could do this using the simple definition that one can see in the pic.

 

RM

 

 

Views: 552

Replies to This Discussion

Integer
Int32

Int32 cannot be larger than 2^31...13! is bigger than this (6,227,020,800 > 2,147,483,648) so it throws an error.

I am guessing this is what is happening. Int64 has a range up to 9,223,372,036,854,775,807 (2^63).

(thanks to Giulio P. for engraving that info into my head ;) )
...and that helps to explain 32-bit vs 64-bit computers!

"A 32-bit address register meant that 2^32 addresses, or 4 GB of RAM, could be referenced."

Thanks Luis + Wikipedia.
I should change the Factorial component to output integers if it can and floating point numbers if you go above 12!.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
I just did. The current Factorial component will no longer be available (but it will load from old files) and the new Factorial component outputs floating point numbers between and including 13! and 170! and +infinity beyond that.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
good now we can go to infinity and beyond!
Hi David,

I was going to script/do something with lists but I'll wait for the new component.
Thanks for the super quick fix.
RM
Thanks Luis I thought it was something like that but wasn't sure. Also thanks for the links they were very informative.
RM

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