flang the compiler proves your program cannot hang 0.9.0 GitHub Try in the browserTry it Русский

Number format

Printing a non-negative number in bases 2–16 and with a fixed number of digits after the point.

Import:

  использует «Number format»

Example

The example was not run for this version of the module. Below is a test from the module source; flang test runs it with the other tests of the module.

функция «В основании»
  дано число равно 255
  дано основание равно 2
  ожидается "11111111"

Functions

Functions to call: 7.

The postcondition statuses were measured for another version of this module and are not shown. Measure again: flang run-script docs:library-status.

«Цифра в основании»

принимает цифра: число
возвращает строка

Test from the module: given цифра = 0 returns "0".

«Основание годно»

принимает основание: число
возвращает признак

Test from the module: given основание = 2 returns да.

«Цифры в основании»

принимает число: число, основание: число, витков: неотрицательное
возвращает строка

Test from the module: given число = 255, основание = 2, витков = 54 returns "11111111".

«В основании»

принимает число: неотрицательное, основание: число
возвращает строка

Test from the module: given число = 255, основание = 2 returns "11111111".

«Дополнить нулями слева»

принимает текст: строка, ширина: неотрицательное
возвращает строка

Test from the module: given текст = "5", ширина = 3 returns "005".

«С точностью»

принимает число: число, знаков: неотрицательное
возвращает строка

Test from the module: given число = 4.35, знаков = 2 returns "4.35".

«Круг основания десять держится»

принимает число: неотрицательное
возвращает признак

Test from the module: given число = 0 returns да.

Source: flang/stdlib/number-format.flang. All modules: Standard library.