<commit_before>const postfixBase = 10 ** 3;

const postfixes = [
    '', // 10^0
    'K', // 1000^1
    'M', // 1000^2
    'G', // 1000^3
    'T', // 1000^4
    'P' // 1000^5
];

function getDisplayValue (value, base) {
    if (value === 0) {
        return '0';
    }
    const unsignedValue = Math.abs(value);
    const sign = Math.sign(value) < 0 ? '-' : '';
    const maximumBase = Math.min(base ? Math.floor(Math.log10(base) / 3) : Infinity, postfixes.length - 1);
    for (let k = maximumBase; k >= 0; k--) {
        const baseValue = postfixBase ** k;
        if (unsignedValue >= baseValue) {
            return `${sign}${Math.floor(unsignedValue / baseValue * postfixBase) / postfixBase}${postfixes[k]}`;
        }
    }
    const digitsPower = Math.max(0, -Math.floor(Math.log10(unsignedValue)));
    const digits = 10 ** digitsPower;
    if (digitsPower > 0) {
        return `${sign}${Math.floor(unsignedValue * digits)}e-${digitsPower}`;
    }
    return `${sign}${Math.floor(unsignedValue * digits) / digits}`;
}

function getClosesBase (value, log = false) {
    if (value <= 0) {
        return 0;
    }
    const digits = Math.floor(Math.log10(value));
    const base = 10 ** digits;
    const test = [
        10 * base,
        !log && 5 * base,<commit_msg>FEATURE COUNTS track: scale rendering fix (for small scales)<commit_after>const postfixBase = 10 ** 3;

const postfixes = [
    '', // 10^0
    'K', // 1000^1
    'M', // 1000^2
    'G', // 1000^3
    'T', // 1000^4
    'P' // 1000^5
];

function getDisplayValue (value, base) {
    if (value === 0) {
        return '0';
    }
    const unsignedValue = Math.abs(value);
    const sign = Math.sign(value) < 0 ? '-' : '';
    const maximumBase = Math.min(base ? Math.floor(Math.log10(base) / 3) : Infinity, postfixes.length - 1);
    for (let k = maximumBase; k >= 0; k--) {
        const baseValue = postfixBase ** k;
        if (unsignedValue >= baseValue) {
            return `${sign}${Math.floor(unsignedValue / baseValue * postfixBase) / postfixBase}${postfixes[k]}`;
        }
    }
    const digitsPower = Math.max(1, -Math.floor(base), -Math.floor(Math.log10(unsignedValue)));
    const digits = 10 ** digitsPower;
    if (digitsPower > 3) {
        return `${sign}${Math.floor(unsignedValue * digits)}e-${digitsPower}`;
    }
    return `${sign}${Math.floor(unsignedValue * digits) / digits}`;
}

function getClosesBase (value, log = false) {
    if (value <= 0) {
        return 0;
    }
    const digits = Math.floor(Math.log10(value));
    const base = 10 ** digits;
    const test = [
        10 * base,
        !log && 5 * base,
{'fraction_non_alphanumeric': 0.173414820473644, 'fraction_numerical': 0.04125286478227655, 'mean_word_length': 2.473474801061008, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4552637', 'n_tokens_mistral': 983, 'n_tokens_neox': 895, 'n_words': 212}