Reads an argument of type "nznumber" (a non-zero number)
(NOTE this isn't strictly as per the spec, since the spec disallows
numbers such as "0123" as nzNumbers (although it's ok as a "number".
I think the spec is a bit shonky.)
545553
public long nzNumber(ImapRequestLineReader request) throws ProtocolException {
        long number = number(request);
        if (number == 0) {
            throw new ProtocolException("Zero value not permitted.");
        }
        return number;
    }
212822
function readNumber(walker) {
    var match = walker.match(/\s*(-?[0-9]+(\.[0-9]+)?)/g, 1);

    if (match) {
        return {
            type: ExprType.NUMBER,
            value: +match[1]
        };
    }
    else if (walker.currentCode() === 45) {
        walker.go(1);
        return {
            type: ExprType.UNARY,
            expr: readUnaryExpr(walker),
            operator: 45
        };
    }
}
703302
def _fix_numeric_types(c):
    
    try:
        for var, data in c.items():
            for k, v in data.items():
                if k in ["hasMeanValue", "hasMaxValue", "hasMinValue", "hasMedianValue"]:
                    if math.isnan(v):
                        c[var][k] = "nan"
                    elif not isinstance(v, (int, float)):
                        try:
                            c[var][k] = float(v)
                        except Exception as e:
                            logger_inferred_data.info("fix_numeric_types: converting float: {}".format(e))
                elif k == "hasResolution":
                    for b, g in v.items():
                        if b in ["hasMeanValue", "hasMaxValue", "hasMinValue", "hasMedianValue"]:
                            if math.isnan(g):
                                c[var][k][b] = "nan"
                            elif not isinstance(g, (int, float)):
                                try:
                                    f = float(g)
                                    c[var][k][b] = f
                                except Exception as e:
                                    logger_inferred_data.info("fix_numeric_types: converting float: {}".format(e))
    except Exception as e:
        logger_inferred_data.error("fix_numeric_types: {}".format(e))
    return c
1132074
function toNumber(value) {
        var _this = this;

        if (validateHelpers.isArray(value)) {
            return value.map(function (a) {
                return _this.toNumber(a);
            });
        }

        var number = parseFloat(value);

        if (number === undefined) {
            return value;
        }

        if (number.toString().length !== value.toString().length && !validateHelpers.isNumeric(value)) {
            return value;
        }

        return validateHelpers.isNumber(number) ? value : number;
    }
502083
def to_int(argument):
	
	if(argument.startswith("0b")):
		return int(argument[2:], 2)
	elif(argument.startswith("0x")):
		return int(argument[2:], 16)
	elif(argument.startswith("0") and argument != "0"):
		return int(argument[1:], 8)
	elif(argument[0] == "'" and argument[2] == "'"):
		return ord(argument[1])
	return int(argument)
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
1072088
def validate_arg(arg, argdef):
        
        datatype = argdef['datatype']
        reasons = set()
        ranges = {
            'ui1': (int, 0, 255),
            'ui2': (int, 0, 65535),
            'ui4': (int, 0, 4294967295),
            'i1': (int, -128, 127),
            'i2': (int, -32768, 32767),
            'i4': (int, -2147483648, 2147483647),
            'r4': (Decimal, Decimal('3.40282347E+38'), Decimal('1.17549435E-38'))
        }
        try:
            if datatype in set(ranges.keys()):
                v_type, v_min, v_max = ranges[datatype]
                if not v_min <= v_type(arg) <= v_max:
                    reasons.add('%r datatype must be a number in the range %s to %s' % (
                        datatype, v_min, v_max))

            elif datatype in {'r8', 'number', 'float', 'fixed.14.4'}:
                v = Decimal(arg)
                if v < 0:
                    assert Decimal('-1.79769313486232E308') <= v <= Decimal('4.94065645841247E-324')
                else:
                    assert Decimal('4.94065645841247E-324') <= v <= Decimal('1.79769313486232E308')

            elif datatype == 'char':
                v = arg.decode('utf8') if six.PY2 or isinstance(arg, bytes) else arg
                assert len(v) == 1

            elif datatype == 'string':
                v = arg.decode("utf8") if six.PY2 or isinstance(arg, bytes) else arg
                if argdef['allowed_values'] and v not in argdef['allowed_values']:
                    reasons.add('Value %r not in allowed values list' % arg)

            elif datatype == 'date':
                v = parse_date(arg)
                if any((v.hour, v.minute, v.second)):
                    reasons.add("'date' datatype must not contain a time")

            elif datatype in ('dateTime', 'dateTime.tz'):
                v = parse_date(arg)
                if datatype == 'dateTime' and v.tzinfo is not None:
                    reasons.add("'dateTime' datatype must not contain a timezone")

            elif datatype in ('time', 'time.tz'):
                now = datetime.datetime.utcnow()
                v = parse_date(arg, default=now)
                if v.tzinfo is not None:
                    now += v.utcoffset()
                if not all((
                        v.day == now.day,
                        v.month == now.month,
                        v.year == now.year)):
                    reasons.add('%r datatype must not contain a date' % datatype)
                if datatype == 'time' and v.tzinfo is not None:
                    reasons.add('%r datatype must not have timezone information' % datatype)

            elif datatype == 'boolean':
                valid = {'true', 'yes', '1', 'false', 'no', '0'}
                if arg.lower() not in valid:
                    reasons.add('%r datatype must be one of %s' % (datatype, ','.join(valid)))

            elif datatype == 'bin.base64':
                b64decode(arg)

            elif datatype == 'bin.hex':
                unhexlify(arg)

            elif datatype == 'uri':
                urlparse(arg)

            elif datatype == 'uuid':
                if not re.match(
                        r'^[0-9a-f]{8}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{12}$',
                        arg, re.I):
                    reasons.add('%r datatype must contain a valid UUID')

            else:
                reasons.add("%r datatype is unrecognised." % datatype)

        except ValueError as exc:
            reasons.add(str(exc))

        return not bool(len(reasons)), reasons
1049199
float  parseNumber(String input, int startpos, int len)
   {
      boolean  isNegative = false;
      long     significand = 0;
      int      numDigits = 0;
      int      numLeadingZeroes = 0;
      int      numTrailingZeroes = 0;
      boolean  decimalSeen = false;
      int      sigStart;
      int      decimalPos = 0;
      int      exponent;

      long     TOO_BIG = Long.MAX_VALUE / 10;

      pos = startpos;

      if (pos >= len)
        return Float.NaN;  // String is empty - no number found

      char  ch = input.charAt(pos);
      switch (ch) {
         case '-': isNegative = true;
                   // fall through
         case '+': pos++;
      }

      sigStart = pos;

      while (pos < len)
      {
         ch = input.charAt(pos);
         if (ch == '0')
         {
            if (numDigits == 0) {
               numLeadingZeroes++;
            } else {
               // We potentially skip trailing zeroes. Keep count for now.
               numTrailingZeroes++;
            }
         }
         else if (ch >= '1' && ch <= '9')
         {
            // Multiply any skipped zeroes into buffer
            numDigits += numTrailingZeroes;
            while (numTrailingZeroes > 0) {
               if (significand > TOO_BIG) {
                  //Log.e("Number is too large");
                  return Float.NaN;
               }
               significand *= 10;
               numTrailingZeroes--;
            }

            if (significand > TOO_BIG) {
               // We will overflow if we continue...
               //Log.e("Number is too large");
               return Float.NaN;
            }
            significand = significand * 10 + ((int)ch - (int)'0');
            numDigits++;
            
            if (significand < 0)
               return Float.NaN;  // overflowed from +ve to -ve
         }
         else if (ch == '.')
         {
            if (decimalSeen) {
               // Stop parsing here.  We may be looking at a new number.
               break;
            }
            decimalPos = pos - sigStart;
            decimalSeen = true;
         }
         else
            break;
         pos++;
      }

      if (decimalSeen && pos == (decimalPos + 1)) {
         // No digits following decimal point (eg. "1.")
         //Log.e("Missing fraction part of number");
         return Float.NaN;
      }

      // Have we seen anything number-ish at all so far?
      if (numDigits == 0) {
         if (numLeadingZeroes == 0) {
            //Log.e("Number not found");
            return Float.NaN;
         }
         // Leading zeroes have been seen though, so we
         // treat that as a '0'.
         numDigits = 1;
      }

      if (decimalSeen) {
         exponent = decimalPos - numLeadingZeroes - numDigits;
      } else {
         exponent = numTrailingZeroes;
      }

      // Now look for exponent
      if (pos < len)
      {
         ch = input.charAt(pos);
         if (ch == 'E' || ch == 'e')
         {
            boolean  expIsNegative = false;
            int      expVal = 0;
            boolean  abortExponent = false;

            pos++;
            if (pos == len) {
               // Incomplete exponent.
               //Log.e("Incomplete exponent of number");
               return Float.NaN;
            }

            switch (input.charAt(pos)) {
               case '-': expIsNegative = true;
                  // fall through
               case '+': pos++;
                  break;
               case '0': case '1': case '2': case '3': case '4':
               case '5': case '6': case '7': case '8': case '9':
                   break; // acceptable next char
               default:
                  // any other character is a failure, ie no exponent.
                  // Could be something legal like "em" though.
                  abortExponent = true;
                  pos--;  // reset pos to position of 'E'/'e'
            }

            if (!abortExponent)
            {
               int  expStart = pos;

               while (pos < len)
               {
                  ch = input.charAt(pos);
                  if (ch >= '0' && ch <= '9')
                  {
                     if (expVal > TOO_BIG) {
                        // We will overflow if we continue...
                        //Log.e("Exponent of number is too large");
                        return Float.NaN;
                     }
                     expVal = expVal * 10 + ((int)ch - (int)'0');
                     pos++;
                  }
                  else
                     break;
               }

               // Check that at least some exponent digits were read
               if (pos == expStart) {
                  //Log.e(""Incomplete exponent of number"");
                  return Float.NaN;
               }

               if (expIsNegative)
                  exponent -= expVal;
               else
                  exponent += expVal;
            }
         }
      }

      // Quick check to eliminate huge exponents.
      // Biggest float is (2 - 2^23) . 2^127 ~== 3.4e38
      // Biggest negative float is 2^-149 ~== 1.4e-45
      // Some numbers that will overflow will get through the scan
      // and be returned as 'valid', yet fail when value() is called.
      // However they will be very rare and not worth slowing down
      // the parse for.
      if ((exponent + numDigits) > 39 || (exponent + numDigits) < -44)
         return Float.NaN;

      float  f = (float) significand;

      if (significand != 0)
      {
         // Do exponents > 0
         if (exponent > 0)
         {
            f *= positivePowersOf10[exponent];
         }
         else if (exponent < 0)
         {
            // Some valid numbers can have an exponent greater than the max (ie. < -38)
            // for a float.  For example, significand=123, exponent=-40
            // If that's the case, we need to apply the exponent in two steps.
            if (exponent < -38) {
               // Long.MAX_VALUE is 19 digits, so taking 20 off the exponent should be enough. 
               f *= 1e-20;
               exponent += 20;
            }
            // Do exponents < 0
            f *= negativePowersOf10[-exponent];
         }
      }

      return (isNegative) ? -f : f;
   }
1247109
function isNaN(value, message, id) {
    if (message === void 0) { message = ''; }
    if (id === void 0) { id = ''; }
    if (this.enabled && !Number.isNaN(value)) {
        throw TypeException.unexpectedType(assertionTypes.IS_NAN, value, '<NaN>', message, id);
    }
}
132766
void expectNumberStrict(Node n, JSType type, String msg) {
    if (!type.isSubtypeOf(getNativeType(NUMBER_TYPE))) {
      registerMismatchAndReport(
          n, INVALID_OPERAND_TYPE, msg, type, getNativeType(NUMBER_TYPE), null, null);
    }
  }
1253422
def str_to_num(self, arg):
        

        if len(arg) == 1:
            ten = '10'
        else:
            ten = ''
        switcher = {
            '一': '1',
            '二': '2',
            '三': '3',
            '四': '4',
            '五': '5',
            '六': '6',
            '七': '7',
            '八': '8',
            '九': '9',
            '十': ten,
            '〇': '0',
            '○': '0',
        }
        test = ''
        for i in arg:
            test = test + switcher.get(i, None)
        return int(test)
529723
function ip2number(str) {
  const strArr = str.split('.');
  // eslint-disable-next-line no-bitwise
  return (Number(strArr[0]) << 24) + (Number(strArr[1]) << 16) + (Number(strArr[2]) << 8) + (Number(strArr[3]));
}
1177594
function parseNumber( str ) {
	var v = parseFloat( str );
	if ( isnan( v ) ) {
		return new TypeError( 'invalid value. Unable to parse string as a number. Value: `' + str + '`.' );
	}
	return v;
}
566557
Number readNumber() throws IOException {
		StringBuilder intPart = null; // ###.xxxExxx
		StringBuilder fraPart = null; // xxx.###Exxx
		StringBuilder expPart = null; // xxx.xxxE###
		boolean hasFraPart = false;
		boolean hasExpPart = false;
		char ch = reader.peek();
		boolean minusSign = ch == '-';
		boolean expMinusSign = false;
		if (minusSign) {
			reader.next();
		}
		int status = READ_NUMBER_INT_PART;
		for (;;) {
			if (reader.hasMore()) {
				ch = reader.peek();
			} else {
				status = READ_NUMBER_END;
			}
			switch (status) {
			case READ_NUMBER_INT_PART:
				if (ch >= '0' && ch <= '9') {
					if (intPart == null) {
						intPart = new StringBuilder(10);
					}
					intPart.append(reader.next());
				} else if (ch == '.') {
					if (intPart == null) {
						throw new JsonParseException("Unexpected char: " + ch,
								reader.readed);
					}
					reader.next();
					hasFraPart = true;
					status = READ_NUMBER_FRA_PART;
				} else if (ch == 'e' || ch == 'E') {
					reader.next();
					hasExpPart = true;
					// try to determin exp part's sign:
					char signChar = reader.peek();
					if (signChar == '-' || signChar == '+') {
						expMinusSign = signChar == '-';
						reader.next();
					}
					status = READ_NUMBER_EXP_PART;
				} else {
					if (intPart == null) {
						throw new JsonParseException("Unexpected char: "
								+ reader.next(), reader.readed);
					}
					// end of number:
					status = READ_NUMBER_END;
				}
				continue;
			case READ_NUMBER_FRA_PART:
				if (ch >= '0' && ch <= '9') {
					if (fraPart == null) {
						fraPart = new StringBuilder(10);
					}
					fraPart.append(reader.next());
				} else if (ch == 'e' || ch == 'E') {
					reader.next();
					hasExpPart = true;
					// try to determin exp part's sign:
					char signChar = reader.peek();
					if (signChar == '-' || signChar == '+') {
						expMinusSign = signChar == '-';
						reader.next();
					}
					status = READ_NUMBER_EXP_PART;
				} else {
					if (fraPart == null) {
						throw new JsonParseException("Unexpected char: "
								+ reader.next(), reader.readed);
					}
					// end of number:
					status = READ_NUMBER_END;
				}
				continue;
			case READ_NUMBER_EXP_PART:
				if (ch >= '0' && ch <= '9') {
					if (expPart == null) {
						expPart = new StringBuilder(10);
					}
					expPart.append(reader.next());
				} else {
					if (expPart == null) {
						throw new JsonParseException("Unexpected char: "
								+ reader.next(), reader.readed);
					}
					// end of number:
					status = READ_NUMBER_END;
				}
				continue;
			case READ_NUMBER_END:
				// build parsed number:
				int readed = reader.readed;
				if (intPart==null) {
				    throw new JsonParseException("Missing integer part of number.", readed);
				}
				long lInt = minusSign ? -string2Long(intPart, readed)
						: string2Long(intPart, readed);
				if (!hasFraPart && !hasExpPart) {
					return new Long(lInt);
				}
				if (hasFraPart && fraPart == null) {
				    throw new JsonParseException("Missing fraction part of number.", readed);
				}
				double dFraPart = hasFraPart ? (minusSign ? -string2Fraction(fraPart, readed)
						: string2Fraction(fraPart, readed))
						: 0.0;
				double number = hasExpPart ? (lInt + dFraPart)
						* Math.pow(10, expMinusSign ? -string2Long(expPart, readed) : string2Long(expPart, readed))
						: (lInt + dFraPart);
				if (number > MAX_SAFE_DOUBLE) {
					throw new NumberFormatException(
							"Exceeded maximum value: 1.7976931348623157e+308");
				}
				return new Double(number);
			}
			continue;
		}
	}
1319803
void expectNumber(Node n, JSType type, String msg) {
    if (!type.matchesNumberContext()) {
      mismatch(n, msg, type, NUMBER_TYPE);
    } else {
      expectNumberStrict(n, type, msg);
    }
  }
390582
function convertFormatNumber (value, num) {
  // 序数
  if (num === 0) {
    return suji(value, '序数');
  }
  // 0埋め
  if (typeof value === 'number') {
    value = value + '';
    return value.length < num ? ('000000000' + value).slice(-num) : value;
  }
  // 切り捨て
  return num && num < value.length ? value.substring(0, num) : value;
}
363307
function NUMBER_VALIDATOR(v) {
  v = (v || '').toString()
  var match = v.match(LENGTH_REGEXP)

  if (match && !match[1]) {
    return {value: parseFloat(v)}
  }

  return {
    value: null,
    reason: function reason(k, v, result) {
      return 'ERROR: property value `' + v + '` is not supported for `' + util.camelCaseToHyphened(k) + '` (only number is supported)'
    }
  }
}