def decode(self, longval, nbits):
val = Fraction(longval, long(<NUM_LIT:1>) << nbits)<EOL>letters = []<EOL>probs_items = [<EOL>(char, minval, maxval)<EOL>for (char, (minval, maxval)) in self._probs.items()<EOL>]<EOL>char = '<STR_LIT:\x00>'<EOL>while True:<EOL><INDENT>for (char, minval, maxval) in probs_items:  <EOL><INDENT>if minval <= val < maxval:<EOL><INDENT>break<EOL><DEDENT><DEDENT>if char == '<STR_LIT:\x00>':<EOL><INDENT>break<EOL><DEDENT>letters.append(char)<EOL>delta = maxval - minval<EOL>val = (val - minval) / delta<EOL><DEDENT>return '<STR_LIT>'.join(letters)<EOL>
Decode the number to a string using the given statistics.

        Parameters
        ----------
        longval : int
            The first part of an encoded tuple from encode
        nbits : int
            The second part of an encoded tuple from encode

        Returns
        -------
        str
            The arithmetically decoded text

        Example
        -------
        >>> ac = Arithmetic('the quick brown fox jumped over the lazy dog')
        >>> ac.decode(16720586181, 34)
        'align'