1367 sub _log_int 1368 { 1369 # calculate integer log of $x to base $base 1370 # ref to array, ref to array - return ref to array 1371 my ($c,$x,$base) = @_; 1372 1373 # X == 0 => NaN 1374 return if (scalar @$x == 1 && $x->[0] == 0); 1375 # BASE 0 or 1 => NaN 1376 return if (scalar @$base == 1 && $base->[0] < 2); 1377 my $cmp = _acmp($c,$x,$base); # X == BASE => 1 1378 if ($cmp == 0) 1379 { 1380 splice (@$x,1); $x->[0] = 1; 1381 return ($x,1) 1382 } 1383 # X < BASE 1384 if ($cmp < 0) 1385 { 1386 splice (@$x,1); $x->[0] = 0; 1387 return ($x,undef); 1388 } 1389