Skip to content

Commit

Permalink
59: Add missing UCUM units
Browse files Browse the repository at this point in the history
Task-Url: #59
  • Loading branch information
keilw committed Sep 4, 2020
1 parent c56c92d commit fdb6e4d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ucum/src/main/java/systems/uom/ucum/UCUM.java
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,12 @@ public static UCUM getInstance() {
* As per <a href="http://unitsofmeasure.org/">UCUM</a> standard.
*/
public static final Unit<Information> BIT = addUnit(new AlternateUnit<Information>(ONE, "bit"), Information.class);

/**
* The bit is defined twice. One definition with a subscript letter ‘s‘ is defined as the logarithmus dualis of the number of distinct signals. However this unit can not practically be used to express more than 1000 bits. Especially when the bit is used to express transmission rate or memory capacities, floating point registers would quickly overflow. Therefore we define a second symbol for bit, without the suffix, to be the dimensionless unit 1.
*/
public static final Unit<Information> BIT_S = addUnit(new AlternateUnit<Information>(BIT, "bit\\u2082"));

/** As per <a href="http://unitsofmeasure.org/">UCUM</a> standard. */
public static final Unit<Information> BYTE = addUnit(BIT.multiply(8));
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ systems.uom.ucum.UCUM.SPHERE=SPH
systems.uom.ucum.UCUM.CARAT_METRIC=[CAR_M]
systems.uom.ucum.UCUM.CARAT_GOLD=[CAR_AU]
systems.uom.ucum.UCUM.BIT=BIT
systems.uom.ucum.UCUM.BIT_S=BIT_S
systems.uom.ucum.UCUM.BYTE=BY
systems.uom.ucum.UCUM.BAUD=Bd
systems.uom.ucum.UCUM.PH=[PH]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ systems.uom.ucum.UCUM.SPHERE=sph
systems.uom.ucum.UCUM.CARAT_METRIC=[car_m]
systems.uom.ucum.UCUM.CARAT_GOLD=[car_Au]
systems.uom.ucum.UCUM.BIT=bit
systems.uom.ucum.UCUM.BIT_S=bit_s
systems.uom.ucum.UCUM.BYTE=By
systems.uom.ucum.UCUM.BAUD=Bd
systems.uom.ucum.UCUM.PH=[pH]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ systems.uom.ucum.UCUM.SPHERE=sph
systems.uom.ucum.UCUM.CARAT_METRIC=ct_m
systems.uom.ucum.UCUM.CARAT_GOLD=ct_Au
systems.uom.ucum.UCUM.BIT=bit
systems.uom.ucum.UCUM.BIT_S=bit\u2082
systems.uom.ucum.UCUM.BYTE=B
systems.uom.ucum.UCUM.BAUD=Bd
systems.uom.ucum.UCUM.PH=pH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

public class SystemOfUnitsServiceTest {
private static final String EXPECTED_SYSTEM_NAME = "Unified Code for Units of Measure";
private static final int NUM_OF_UNITS = 248;
private static final int NUM_OF_UNITS = 249;

private static SystemOfUnitsService defaultService;

Expand Down

0 comments on commit fdb6e4d

Please sign in to comment.