ext/games_dice/probabilities.c in games_dice-0.3.7 vs ext/games_dice/probabilities.c in games_dice-0.3.8
- old
+ new
@@ -39,11 +39,11 @@
return m;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//
-// Quick factorials, that fit into unsigned longs . . . the size of this structure sets the
+// Quick factorials, that fit into doubles. . . the size of this structure sets the
// maximum possible n in repeat_n_sum_k calculations
//
// There is no point calculating these, a cache of them is just fine.
double nfact[171] = {
@@ -742,14 +742,18 @@
alloc_probs_iv( pl, s, 1.0/s );
return obj;
}
VALUE probabilities_from_h( VALUE self, VALUE hash ) {
+ VALUE obj;
+ ProbabilityList *pl;
+ double error;
+
Check_Type( hash, T_HASH );
- VALUE obj = pl_alloc( Probabilities );
- ProbabilityList *pl = get_probability_list( obj );
- double error;
+ obj = pl_alloc( Probabilities );
+ pl = get_probability_list( obj );
+
// Set these up so that they get adjusted during hash iteration
pl->offset = 0x7fffffff;
pl->slots = 0;
// First iteration establish min/max and validate all key/values