Skip to content

Digital storage unit 'b'/'B' is reversed from convention #11

@JDLH

Description

@JDLH

The phrases for digital storage units in the code use a lowercase 'b' for bytes, and an uppercase 'B' for bits. I believe this is the reverse of the usual convention. For example, the IEEE 1541-2002 standard recommends (according to Wikipedia):

  • "bit (symbol 'b'), a binary digit;"
  • "byte (symbol 'B'), a set of adjacent bits (usually, but not necessarily, eight) operated on as a group;"

The relevant code:

fcal/src/default/units.ts

Lines 303 to 439 in c6c8f81

function setDigitalStorageUnits(units: IUseUnit[]): void {
units.push(
...[
{
id: Unit.DIGITAL_ID,
phrases: ['bit'],
ratio: 1,
type: 'bit',
},
{
id: Unit.DIGITAL_ID,
phrases: ['kilobit', 'kB'],
ratio: 1000,
type: 'kilobit',
},
{
id: Unit.DIGITAL_ID,
phrases: ['kibibit', 'kiB'],
ratio: 1024,
type: 'kibibit',
},
{
id: Unit.DIGITAL_ID,
phrases: ['megabit', 'mB'],
ratio: 1e6,
type: 'megabit',
},
{
id: Unit.DIGITAL_ID,
phrases: ['mebibit', 'miB'],
ratio: '1.049e+6',
type: 'mebibit',
},
{
id: Unit.DIGITAL_ID,
phrases: ['gigabit', 'gB'],
ratio: 1e9,
type: 'gigabit',
},
{
id: Unit.DIGITAL_ID,
phrases: ['gibibit', 'giB'],
ratio: '1.074e+9',
type: 'gibibit',
},
{
id: Unit.DIGITAL_ID,
phrases: ['terabit', 'tB'],
ratio: 1e12,
type: 'terabit',
},
{
id: Unit.DIGITAL_ID,
phrases: ['tebibit', 'tiB'],
ratio: '1.1e+12',
type: 'tebibit',
},
{
id: Unit.DIGITAL_ID,
phrases: ['petabit', 'pB'],
ratio: 1e15,
type: 'petabit',
},
{
id: Unit.DIGITAL_ID,
phrases: ['pebibit', 'piB'],
ratio: '1.126e+15',
type: 'pebibit',
},
{
id: Unit.DIGITAL_ID,
phrases: ['byte', 'b'],
ratio: 8,
type: 'byte',
},
{
id: Unit.DIGITAL_ID,
phrases: ['kilobyte', 'kb'],
ratio: 8000,
type: 'kilobyte',
},
{
id: Unit.DIGITAL_ID,
phrases: ['kibibyte', 'kib'],
ratio: 8192,
type: 'kibibyte',
},
{
id: Unit.DIGITAL_ID,
phrases: ['megabyte', 'mb'],
ratio: 8e6,
type: 'megabyte',
},
{
id: Unit.DIGITAL_ID,
phrases: ['mebibyte', 'mib'],
ratio: '8.389e+6',
type: 'mebibyte',
},
{
id: Unit.DIGITAL_ID,
phrases: ['gigabyte', 'gb'],
ratio: 8e9,
type: 'gigabyte',
},
{
id: Unit.DIGITAL_ID,
phrases: ['gibibyte', 'gib'],
ratio: '8.59e+9',
type: 'gibibyte',
},
{
id: Unit.DIGITAL_ID,
phrases: ['terabyte', 'tb'],
ratio: 8e12,
type: 'terabyte',
},
{
id: Unit.DIGITAL_ID,
phrases: ['tebibyte', 'tib'],
ratio: '8.796e+12',
type: 'tebibyte',
},
{
id: Unit.DIGITAL_ID,
phrases: ['petabyte', 'pb'],
ratio: 8e15,
type: 'petabyte',
},
{
id: Unit.DIGITAL_ID,
phrases: ['pebibyte', 'pib'],
ratio: '9.007e+15',
type: 'pebibyte',
},
],
);

Thus I suggest that for each unit object, the final character 'b' or 'B' in the final entry in the phrases array be replaced by the character with the opposite case.

If this change gets made, the text of issue #10 about the Units wiki page also be corrected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions