Initialize a number format with ELKI standard options (US locale, no
grouping).

@param digits Number of digits to use
@return Number format
345905
public static NumberFormat makeNumberFormat(int digits) {
    // Prefer predefined number formats where applicable.
    // TODO: cache others, too?
    switch(digits){
    case 0:
      return NF0;
    case 2:
      return NF2;
    case 3:
      return NF3;
    case 4:
      return NF4;
    case 6:
      return NF6;
    case 8:
      return NF8;
    }
    final NumberFormat nf = NumberFormat.getInstance(Locale.US);
    nf.setMaximumFractionDigits(digits);
    nf.setMinimumFractionDigits(digits);
    nf.setGroupingUsed(false);
    return nf;
  }
1264588
public final String format(android.icu.math.BigDecimal number) {
        return format(number, new StringBuffer(),
                      new FieldPosition(0)).toString();
    }
1154585
protected function getFormatter($locale, $digits)
    {
        $formatter = $this->retrieveDecimalFormatter($locale);
        $formatter->setAttribute(NumberFormatter::MIN_FRACTION_DIGITS, $digits);
        $formatter->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, $digits);
        $formatter->setAttribute(NumberFormatter::DECIMAL_ALWAYS_SHOWN, 1);

        return $formatter;
    }
666954
def read_digits(self, start: int, char: str) -> int:
        """"""
        source = self.source
        body = source.body
        position = start
        while "0" <= char <= "9":
            position += 1
            char = body[position : position + 1]
        if position == start:
            raise GraphQLSyntaxError(
                source,
                position,
                f"Invalid number, expected digit but got: {print_char(char)}.",
            )
        return position
1114341
private static char[] mapChar (byte[] digits) {
		char[] result = new char[digits.length];

		for (int i=0; i<digits.length; i++)
			result[i] = mapChar(digits[i]);

		return result;
	}
468042
public NumberFormatter getNumberFormatter(CLDR.Locale locale) {
    locale = bundleMatch(locale);
    NumberFormatter formatter = NUMBER_FORMATTERS.get(locale);
    return formatter == null ? NUMBER_FORMATTERS.get(CLDR.Locale.en_US) : formatter;
  }
824247
@Transformer(requireTemplate = true)
    public static String format(Number number, String pattern, Locale locale) {
        return format(null, number, pattern, locale);
    }
1123860
public static String toUidString(int number) {
        StringBuilder builder = new StringBuilder();
        while (number > 0) {
            builder.append(UID[number % UID_LENGTH]);
            number /= UID_LENGTH;
        }
        return builder.toString();
    }
659865
public static String formatNum(
      ULocale uLocale,
      double number,
      String formatType,
      String numbersKeyword,
      @Nullable Integer minFractionDigits,
      @Nullable Integer maxFractionDigits) {
    uLocale = uLocale.setKeywordValue("numbers", numbersKeyword);
    NumberFormat numberFormat;
    switch (formatType) {
      case "decimal":
        numberFormat = NumberFormat.getInstance(uLocale);
        break;
      case "percent":
        numberFormat = NumberFormat.getPercentInstance(uLocale);
        break;
      case "currency":
        numberFormat = NumberFormat.getCurrencyInstance(uLocale);
        break;
      case "scientific":
        numberFormat = NumberFormat.getScientificInstance(uLocale);
        break;
      case "compact_short":
        {
          CompactDecimalFormat compactNumberFormat =
              CompactDecimalFormat.getInstance(uLocale, CompactStyle.SHORT);
          compactNumberFormat.setMaximumSignificantDigits(3);
          numberFormat = compactNumberFormat;
          break;
        }
      case "compact_long":
        {
          CompactDecimalFormat compactNumberFormat =
              CompactDecimalFormat.getInstance(uLocale, CompactStyle.LONG);
          compactNumberFormat.setMaximumSignificantDigits(3);
          numberFormat = compactNumberFormat;
          break;
        }
      default:
        throw new IllegalArgumentException(
            "First argument to formatNum must be "
                + "constant, and one of: 'decimal', 'currency', 'percent', 'scientific', "
                + "'compact_short', or 'compact_long'.");
    }

    if (minFractionDigits != null) {
      numberFormat.setMinimumFractionDigits(minFractionDigits);
    }
    if (maxFractionDigits != null) {
      numberFormat.setMaximumFractionDigits(maxFractionDigits);
    }
    return numberFormat.format(number);
  }
74761
def grouped_digits(digits)
      unless (digits.size % @base_scale) == 0
        raise "Invalid number of digits for group_digits (#{digits.size} is not a multiple of #{@base_scale})"
      end
      digits.each_slice(@base_scale).map{|group| scaled_digit(group)}
    end
589207
public <N extends Number> CellFormatResult format(final String formatPattern, final N value, final Locale locale) {
        return format(new NumberCell<N>(value, formatPattern), locale);
    }
322039
public String getNumberText(final int digits) {
    String result = "";
    for (int i = 0; i < digits; i++) {
      result = result + random.nextInt(10);
    }
    return result;
  }
123415
public static String format(BigDecimal number, String pattern) {
		return format(number.doubleValue(), pattern);
	}
385712
public String getDenominatorPart(final int digit) {
        
        final int length = denominatorPart.length();
        if(length < digit || digit <= 0) {
            return "";
        }
        
        return String.valueOf(denominatorPart.charAt(length - digit));
    }
800883
private static String formatInt(int number) {
        String str = Integer.toString(number);
        return number < 10 ? " " + str : str;
    }
753562
private String digits() {
    StringBuilder sb = new StringBuilder();
    do {
      sb.append(consumeNextCharacter(CharType.DIGIT));
    } while (chars.positiveLookahead(CharType.DIGIT));
    return sb.toString();
  }
969905
private String format(double n) {
        NumberFormat nf = NumberFormat.getNumberInstance(Locale.ENGLISH);
        nf.setMaximumFractionDigits(1);
        nf.setGroupingUsed(false);
        return nf.format(n);
    }