MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / factorial64

Function factorial64

libraries/statHelpers/statHelpers.cpp:137–146  ·  view source on GitHub ↗

exact ==> 20!

Source from the content-addressed store, hash-verified

135
136// exact ==> 20!
137uint64_t factorial64(uint8_t n)
138{
139 // to be tested
140 // if ( n <= 12) return factorial(12);
141 // uint64_t f = factorial(12);
142 // for (uint8_t t = 13; t <= n; t++) f *= t;
143 uint64_t f = 1;
144 while(n > 1) f *= (n--);
145 return f;
146}
147
148
149// float (4 byte) => 34!

Callers 1

unittestFunction · 0.85

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.68