Takes a decimal number as input and returns the number of ones in the
    binary representation.
    This translates to the number of tasks being done by an organism with a
    phenotype represented as a decimal number.
425477
def n_tasks(dec_num):
    
    bitstring = ""
    try:
        bitstring = dec_num[2:]
    except:
        bitstring = bin(int(dec_num))[2:]  # cut off 0b
    # print bin(int(dec_num)), bitstring
    return bitstring.count("1")
192681
static Number asNumber(BitStore store) {
		return new Number() {

			private static final long serialVersionUID = -2906430071162493968L;

			final int size = store.size();

			@Override
			public byte byteValue() {
				return (byte) store.getBits(0, Math.min(8, size));
			}

			@Override
			public short shortValue() {
				return (short) store.getBits(0, Math.min(16, size));
			}

			@Override
			public int intValue() {
				return (int) store.getBits(0, Math.min(32, size));
			}

			@Override
			public long longValue() {
				return store.getBits(0, Math.min(64, size));
			}

			@Override
			public float floatValue() {
				return store.toBigInteger().floatValue();
			}

			@Override
			public double doubleValue() {
				return store.toBigInteger().doubleValue();
			}

		};
	}
302468
def base26int(s, _start=1 - ord('A')):
    
    return sum((_start + ord(c)) * 26**i for i, c in enumerate(reversed(s)))
425921
function fmtCurrency(number, digit) {
      if (isUdf(digit)) digit = 2;
      var nbArr = String(number.toFixed(digit)).split('.')
        , integer = nbArr[0]
        , decimal = nbArr.length > 1 ? nbArr[1] : ''
        , integerStr, spn, sti, i;
      spn = Math.floor(integer.length / 3);
      sti = integer.length % 3;
      integerStr = integer.substr(0, sti);
      for (i = 0; i < spn; i++) {
        integerStr += (i === 0 && !integerStr) ? integer.substr(sti, 3) : ',' + integer.substr(sti, 3);
        sti += 3;
      }
      return decimal ? integerStr + '.' + decimal : integerStr;
    }
63386
private static function size($number, int $decimal = 2, bool $binary = false)
	{
		return Number::size(self::prepareFloat($number), $decimal, $binary);
	}
71135
public int count()
    {
        int count = 0;
        for (int ii=bits-1;ii>=0;ii--)
        {
            if (isSet(ii))
            {
                count++;
            }
        }
        return count;
    }
1069859
def number(self, number):
        
        s = [ord(x) for x in str(number)] + [14]  # Bytes of string representation in bytes

        if number == int(number) and abs(number) < 65536:  # integer form?
            sign = 0xFF if number < 0 else 0
            b = [0, sign] + self.numberLH(number) + [0]
        else:  # Float form
            (C, ED, LH) = fp.immediate_float(number)
            C = C[:2]  # Remove 'h'
            ED = ED[:4]  # Remove 'h'
            LH = LH[:4]  # Remove 'h'

            b = [int(C, 16)]  # Convert to BASE 10
            b += [int(ED[:2], 16), int(ED[2:], 16)]
            b += [int(LH[:2], 16), int(LH[2:], 16)]

        return s + b
1328851
function lengthOfNumber(number) {
        if (isNumber(number)) {
            var length_1 = 0;
            while (number > 0) {
                length_1++;
                number = backIntegerOfNumber(number / 10);
            }
            return length_1;
        }
        else {
            return 0;
        }
    }
423216
function NUM() {
        var _parser = SEQ(OPT('-'), OR('0', SEQ(RANGE('1', '9'), REPEAT(DIGIT()))), OPT(SEQ('.', REPEAT(DIGIT(), 1))), OPT(SEQ(OR('e', 'E'), OPT(OR('+', '-')), REPEAT(DIGIT(), 1))));

        return _make_alias('NUM', paka.P.NUM, _parser);
    }
1273869
function (number, halfSteps) {
  var diatonicHalfSteps = getDiatonicHalfSteps(number);
  var halfStepOffset = halfSteps - diatonicHalfSteps;

  // Handle various abnormalities
  if (halfStepOffset === 11) halfStepOffset = -1;
  if (halfStepOffset === -11) halfStepOffset = 1;

  return halfStepOffset;
}
193149
def NumbersToWords(number):
    

    units = [
        'one',
        'two',
        'three',
        'four',
        'five',
        'six',
        'seven',
        'eight',
        'nine']
    tens = [
        'ten',
        'twenty',
        'thirty',
        'forty',
        'fifty',
        'sixty',
        'seventy',
        'eighty',
        'ninety']
    output = ""
    if number != 0:
        str_val = str(number)
        if 4 > len(str_val) > 2:
            output += units[int(str_val[0]) - 1]
            output += "hundred"
            if str_val[1] != 0:
                output += "and" + tens[int(str_val[1]) - 1]
                if str_val[2] != 0:
                    output += units[int(str_val[2]) - 1]
        if 3 > len(str_val) > 1:
            output += tens[int(str_val[0]) - 1]
            if str_val[1] != 0:
                output += units[int(str_val[1]) - 1]
        if 2 > len(str_val) == 1:
            output += units[int(str_val[0]) - 1]
    else:
        output = "zero"
    return output
285221
def baseN(num, b, numerals="0123456789abcdefghijklmnopqrstuvwxyz"):
    
    return ((num == 0) and numerals[0]) or \
        (baseN(num // b, b, numerals).lstrip(numerals[0]) + numerals[num % b])
262660
private static Number asNumber(Object value) {
    Number num = null;
    if (value == null) {
      num = null;
    } else if (value instanceof Number) {
      num = (Number) value;
    } else if (value instanceof Boolean) {
      num = ((Boolean) value) ? 1 : 0;
    }
    return num;
  }
1233646
private function integerDivision(DecimalNumber $a, DecimalNumber $b, $precision)
    {
        $dividend = $a->getCoefficient();
        $divisor = new DecimalNumber($b->getCoefficient());
        $dividendLength = strlen($dividend);
        $result = '';
        $exponent = 0;

        $currentSequence = '';
        for ($i = 0; $i < $dividendLength; $i++) {
            // append digits until we get a number big enough to divide
            $currentSequence .= $dividend[$i];

            if ($currentSequence < $divisor) {
                if (!empty($result)) {
                    $result .= '0';
                }
            } else {
                // subtract divisor as many times as we can
                $remainder = new DecimalNumber($currentSequence);
                $multiple = 0;
                do {
                    $multiple++;
                    $remainder = $remainder->minus($divisor);
                } while ($remainder->isGreaterOrEqualThan($divisor));

                $result .= (string) $multiple;

                // reset sequence to the reminder
                $currentSequence = (string) $remainder;
            }

            // add up to $precision decimals
            if ($currentSequence > 0 && $i === $dividendLength - 1 && $precision > 0) {
                // "borrow" up to $precision digits
                --$precision;
                $dividend .= '0';
                $dividendLength++;
                $exponent++;
            }
        }

        $sign = ($a->isNegative() xor $b->isNegative()) ? '-' : '';

        return new DecimalNumber($sign . $result, $exponent);
    }
356248
private int binaryFirstSearch() {

        int low     = 0;
        int high    = count;
        int mid     = 0;
        int compare = 0;
        int found   = count;

        while (low < high) {
            mid     = (low + high) / 2;
            compare = compare(mid);

            if (compare < 0) {
                high = mid;
            } else if (compare > 0) {
                low = mid + 1;
            } else {
                high  = mid;
                found = mid;
            }
        }

        return found == count ? -1
                              : found;
    }
640041
function(num) {
            if(typeof num !== "number") {
                return NaN;
            }
            var isNegative = num < 0;
            num = (isNegative) ? -num : num;
            var log = this.logBaseTen(num),
                result = Math.pow(10, Math.floor(log));

            return (isNegative) ? -result: result;
        }
1029211
def value(self):
        '''
        
        '''
        (counter_type, value) = win32pdh.GetFormattedCounterValue(
            self.handle, win32pdh.PDH_FMT_DOUBLE)
        self.type = counter_type
        return value