src/misc.cpp

changeset 542
46a33bdc0b36
parent 541
0e38beeb050a
child 544
a52cfa218780
equal deleted inserted replaced
541:0e38beeb050a 542:46a33bdc0b36
79 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 79 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413,
80 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 80 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511,
81 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 81 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571,
82 }; 82 };
83 83
84 static const int32 g_e10[] =
85 { 1,
86 10,
87 100,
88 1000,
89 10000,
90 100000,
91 1000000,
92 10000000,
93 100000000,
94 1000000000,
95 };
96
84 // ============================================================================= 97 // =============================================================================
85 // ----------------------------------------------------------------------------- 98 // -----------------------------------------------------------------------------
86 // Grid stuff 99 // Grid stuff
87 cfg (Int, grid, Grid::Medium); 100 cfg (Int, grid, Grid::Medium);
88 101
408 // Solutions have equal rings and equal maximum ring numbers. Let's 421 // Solutions have equal rings and equal maximum ring numbers. Let's
409 // just say this one is better, at this point it does not matter which 422 // just say this one is better, at this point it does not matter which
410 // one is chosen. 423 // one is chosen.
411 return true; 424 return true;
412 } 425 }
426
427 // =============================================================================
428 // -----------------------------------------------------------------------------
429 void roundToDecimals (double& a, int decimals)
430 { assert (decimals >= 0 && decimals < (signed) (sizeof g_e10 / sizeof *g_e10));
431 a = round (a * g_e10[decimals]) / g_e10[decimals];
432 }

mercurial