Jump to content

Template:Bintodec

From Meta, a Wikimedia project coordination wiki

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}} gives 70368744177664 [4]

{{#expr:2^47}} gives 1.4073748835533E+14 [5]

See also

[edit]