Sha256: d7707e71ad89ebd799d6547aa93d9b409f6a37644892d553da0c9b5861f87333

Contents?: true

Size: 618 Bytes

Versions: 4

Compression:

Stored size: 618 Bytes

Contents

# -*- encoding: utf-8 -*-
# -*- frozen_string_literal: true -*-
# -*- warn_indent: true -*-

UnitMeasurements::InformationEntropy = UnitMeasurements.build do
  primitive "nat"

  si_unit "b", value: "1 Sh", aliases: ["bit", "bits"]
  si_unit "B", value: [2.pow(3), "b"], aliases: ["byte", "bytes"]

  unit "Sh", value: [Math.log(2), "nat"], aliases: ["shannon", "shannons"]
  unit "nat", aliases: ["nit", "nepit", "natural unit of information"]
  unit "nybl", value: [2.pow(2), "b"], aliases: ["nibble", "nibbles", "nybble", "nyble"]
  unit "Hart", value: [Math.log(10), "nat"], aliases: ["hartley", "ban", "dit"]
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
unit_measurements-4.12.0 lib/unit_measurements/unit_groups/information_entropy.rb
unit_measurements-4.11.0 lib/unit_measurements/unit_groups/information_entropy.rb
unit_measurements-4.10.0 lib/unit_measurements/unit_groups/information_entropy.rb
unit_measurements-4.9.0 lib/unit_measurements/unit_groups/information_entropy.rb