Jump to content

Template:Bintodec

From mediawiki.org

0

Template documentation

This templates returns an integer of which the binary representation in reverse order forms the Boolean array indicating which of the parameters 1-7 are defined and non-empty.

Examples:

  • {{bintodec}} → 0 [1]
  • {{bintodec|5}} → 1 [2]
  • {{bintodec|5|2}} gives 3 [3]
  • {{bintodec|3=x|5=y}} gives 20
  • {{bintodec|3=x|5=y|3=}} gives 16

Without special provisions this template can be extended to work for arrays of at most 46 elements:

{{#expr:2^46}} 70368744177664

{{#expr:2^47}} 1.4073748835533E+14

See also

[edit]