Je suis Charlie

Autres trucs

Accueil

Seulement les RFC

Seulement les fiches de lecture

Mon livre « Cyberstructure »

Ève

Implementation of the bioctal number format

First publication of this article on 14 April 2022


I just wrote an implementation of the bioctal number format, which is specified in RFC 9226 (RFC published on 1st April 2022).

The RFC standardizes a number format called "bioctal". I let you read the RFC to understand the rationale of this format. The implementation is written in the Elixir programming language and is available in the file bioctal.ex. It provides:

  • Sigils (Elixir's way to use literals in various formats; sigils start with a tilde) for input,
  • A formatting of numbers in bioctal for output.

An example of input:

IO.puts(~b{23cj}) # Thanks to the sigil ~b, "23cj" will be read as 9097
  

And an example of output:

IO.puts(format(9097)) # Will print "23cj"
  

Version PDF de cette page (mais vous pouvez aussi imprimer depuis votre navigateur, il y a une feuille de style prévue pour cela)

Source XML de cette page (cette page est distribuée sous les termes de la licence GFDL)