unit: use SI spelling for SI units
MODIFY
unit/acceleration.go
unit/acceleration.go
@@ -13,7 +13,7 @@ import (
"unicode/utf8"
)
-// Acceleration represents an acceleration in meters per second squared.
+// Acceleration represents an acceleration in metres per second squared.
type Acceleration float64
// Unit converts the Acceleration to a *Unit

MODIFY
unit/area.go
unit/area.go
@@ -13,7 +13,7 @@ import (
"unicode/utf8"
)
-// Area represents and area in square meters.
+// Area represents and area in square metres.
type Area float64
// Unit converts the Area to a *Unit

MODIFY
unit/generate_unit.go
unit/generate_unit.go
@@ -190,9 +190,9 @@ var Units = []Unit{
Name: "Length",
Receiver: "l",
PrintString: "m",
- Suffix: "meter",
- Singular: "Meter",
- TypeComment: "Length represents a length in meters",
+ Suffix: "metre",
+ Singular: "Metre",
+ TypeComment: "Length represents a length in metres",
Dimensions: []Dimension{
{Name: LengthName, Power: 1},
},
@@ -277,7 +277,7 @@ var Units = []Unit{
Name: "Acceleration",
Receiver: "a",
PrintString: "m s^-2",
- TypeComment: "Acceleration represents an acceleration in meters per second squared",
+ TypeComment: "Acceleration represents an acceleration in metres per second squared",
Dimensions: []Dimension{
{Name: LengthName, Power: 1},
{Name: TimeName, Power: -2},
@@ -287,7 +287,7 @@ var Units = []Unit{
Name: "Area",
Receiver: "a",
PrintString: "m^2",
- TypeComment: "Area represents and area in square meters",
+ TypeComment: "Area represents and area in square metres",
Dimensions: []Dimension{
{Name: LengthName, Power: 2},
},
@@ -484,9 +484,9 @@ var Units = []Unit{
Name: "Torque",
Receiver: "t",
PrintString: "N m",
- Suffix: "newtonmeter",
- Singular: "Newtonmeter",
- TypeComment: "Torque represents a torque in Newton meters",
+ Suffix: "newtonmetre",
+ Singular: "Newtonmetre",
+ TypeComment: "Torque represents a torque in Newton metres",
Dimensions: []Dimension{
{Name: LengthName, Power: 2},
{Name: MassName, Power: 1},
@@ -498,7 +498,7 @@ var Units = []Unit{
Name: "Velocity",
Receiver: "v",
PrintString: "m s^-1",
- TypeComment: "Velocity represents a velocity in meters per second",
+ TypeComment: "Velocity represents a velocity in metres per second",
Dimensions: []Dimension{
{Name: LengthName, Power: 1},
{Name: TimeName, Power: -1},
@@ -524,9 +524,9 @@ var Units = []Unit{
Receiver: "v",
Offset: -3,
PrintString: "m^3",
- Suffix: "liter",
- Singular: "Liter",
- TypeComment: "Volume represents a volume in cubic meters",
+ Suffix: "litre",
+ Singular: "Litre",
+ TypeComment: "Volume represents a volume in cubic metres",
Dimensions: []Dimension{
{Name: LengthName, Power: 3},
},

MODIFY
unit/length.go
unit/length.go
@@ -13,31 +13,31 @@ import (
"unicode/utf8"
)
-// Length represents a length in meters.
+// Length represents a length in metres.
type Length float64
const (
- Yottameter Length = 1e24
- Zettameter Length = 1e21
- Exameter Length = 1e18
- Petameter Length = 1e15
- Terameter Length = 1e12
- Gigameter Length = 1e9
- Megameter Length = 1e6
- Kilometer Length = 1e3
- Hectometer Length = 1e2
- Decameter Length = 1e1
- Meter Length = 1.0
- Decimeter Length = 1e-1
- Centimeter Length = 1e-2
- Millimeter Length = 1e-3
- Micrometer Length = 1e-6
- Nanometer Length = 1e-9
- Picometer Length = 1e-12
- Femtometer Length = 1e-15
- Attometer Length = 1e-18
- Zeptometer Length = 1e-21
- Yoctometer Length = 1e-24
+ Yottametre Length = 1e24
+ Zettametre Length = 1e21
+ Exametre Length = 1e18
+ Petametre Length = 1e15
+ Terametre Length = 1e12
+ Gigametre Length = 1e9
+ Megametre Length = 1e6
+ Kilometre Length = 1e3
+ Hectometre Length = 1e2
+ Decametre Length = 1e1
+ Metre Length = 1.0
+ Decimetre Length = 1e-1
+ Centimetre Length = 1e-2
+ Millimetre Length = 1e-3
+ Micrometre Length = 1e-6
+ Nanometre Length = 1e-9
+ Picometre Length = 1e-12
+ Femtometre Length = 1e-15
+ Attometre Length = 1e-18
+ Zeptometre Length = 1e-21
+ Yoctometre Length = 1e-24
)
// Unit converts the Length to a *Unit
@@ -55,7 +55,7 @@ func (l Length) Length() Length {
// From converts the unit into the receiver. From returns an
// error if there is a mismatch in dimension
func (l *Length) From(u Uniter) error {
- if !DimensionsMatch(u, Meter) {
+ if !DimensionsMatch(u, Metre) {
*l = Length(math.NaN())
return errors.New("Dimension mismatch")
}

MODIFY
unit/torque.go
unit/torque.go
@@ -13,31 +13,31 @@ import (
"unicode/utf8"
)
-// Torque represents a torque in Newton meters.
+// Torque represents a torque in Newton metres.
type Torque float64
const (
- Yottanewtonmeter Torque = 1e24
- Zettanewtonmeter Torque = 1e21
- Exanewtonmeter Torque = 1e18
- Petanewtonmeter Torque = 1e15
- Teranewtonmeter Torque = 1e12
- Giganewtonmeter Torque = 1e9
- Meganewtonmeter Torque = 1e6
- Kilonewtonmeter Torque = 1e3
- Hectonewtonmeter Torque = 1e2
- Decanewtonmeter Torque = 1e1
- Newtonmeter Torque = 1.0
- Decinewtonmeter Torque = 1e-1
- Centinewtonmeter Torque = 1e-2
- Millinewtonmeter Torque = 1e-3
- Micronewtonmeter Torque = 1e-6
- Nanonewtonmeter Torque = 1e-9
- Piconewtonmeter Torque = 1e-12
- Femtonewtonmeter Torque = 1e-15
- Attonewtonmeter Torque = 1e-18
- Zeptonewtonmeter Torque = 1e-21
- Yoctonewtonmeter Torque = 1e-24
+ Yottanewtonmetre Torque = 1e24
+ Zettanewtonmetre Torque = 1e21
+ Exanewtonmetre Torque = 1e18
+ Petanewtonmetre Torque = 1e15
+ Teranewtonmetre Torque = 1e12
+ Giganewtonmetre Torque = 1e9
+ Meganewtonmetre Torque = 1e6
+ Kilonewtonmetre Torque = 1e3
+ Hectonewtonmetre Torque = 1e2
+ Decanewtonmetre Torque = 1e1
+ Newtonmetre Torque = 1.0
+ Decinewtonmetre Torque = 1e-1
+ Centinewtonmetre Torque = 1e-2
+ Millinewtonmetre Torque = 1e-3
+ Micronewtonmetre Torque = 1e-6
+ Nanonewtonmetre Torque = 1e-9
+ Piconewtonmetre Torque = 1e-12
+ Femtonewtonmetre Torque = 1e-15
+ Attonewtonmetre Torque = 1e-18
+ Zeptonewtonmetre Torque = 1e-21
+ Yoctonewtonmetre Torque = 1e-24
)
// Unit converts the Torque to a *Unit
@@ -57,7 +57,7 @@ func (t Torque) Torque() Torque {
// From converts the unit into the receiver. From returns an
// error if there is a mismatch in dimension
func (t *Torque) From(u Uniter) error {
- if !DimensionsMatch(u, Newtonmeter) {
+ if !DimensionsMatch(u, Newtonmetre) {
*t = Torque(math.NaN())
return errors.New("Dimension mismatch")
}

MODIFY
unit/unittype.go
unit/unittype.go
@@ -254,7 +254,7 @@ type Unit struct {
// New creates a new variable of type Unit which has the value and dimensions
// specified by the inputs. The built-in dimensions are always in SI units
-// (meters, kilograms, etc.).
+// (metres, kilograms, etc.).
func New(value float64, d Dimensions) *Unit {
return &Unit{
dimensions: d.clone(),

MODIFY
unit/velocity.go
unit/velocity.go
@@ -13,7 +13,7 @@ import (
"unicode/utf8"
)
-// Velocity represents a velocity in meters per second.
+// Velocity represents a velocity in metres per second.
type Velocity float64
// Unit converts the Velocity to a *Unit

MODIFY
unit/volume.go
unit/volume.go
@@ -13,31 +13,31 @@ import (
"unicode/utf8"
)
-// Volume represents a volume in cubic meters.
+// Volume represents a volume in cubic metres.
type Volume float64
const (
- Yottaliter Volume = 1e21
- Zettaliter Volume = 1e18
- Exaliter Volume = 1e15
- Petaliter Volume = 1e12
- Teraliter Volume = 1e9
- Gigaliter Volume = 1e6
- Megaliter Volume = 1e3
- Kiloliter Volume = 1.0
- Hectoliter Volume = 1e-1
- Decaliter Volume = 1e-2
- Liter Volume = 1e-3
- Deciliter Volume = 1e-4
- Centiliter Volume = 1e-5
- Milliliter Volume = 1e-6
- Microliter Volume = 1e-9
- Nanoliter Volume = 1e-12
- Picoliter Volume = 1e-15
- Femtoliter Volume = 1e-18
- Attoliter Volume = 1e-21
- Zeptoliter Volume = 1e-24
- Yoctoliter Volume = 1e-27
+ Yottalitre Volume = 1e21
+ Zettalitre Volume = 1e18
+ Exalitre Volume = 1e15
+ Petalitre Volume = 1e12
+ Teralitre Volume = 1e9
+ Gigalitre Volume = 1e6
+ Megalitre Volume = 1e3
+ Kilolitre Volume = 1.0
+ Hectolitre Volume = 1e-1
+ Decalitre Volume = 1e-2
+ Litre Volume = 1e-3
+ Decilitre Volume = 1e-4
+ Centilitre Volume = 1e-5
+ Millilitre Volume = 1e-6
+ Microlitre Volume = 1e-9
+ Nanolitre Volume = 1e-12
+ Picolitre Volume = 1e-15
+ Femtolitre Volume = 1e-18
+ Attolitre Volume = 1e-21
+ Zeptolitre Volume = 1e-24
+ Yoctolitre Volume = 1e-27
)
// Unit converts the Volume to a *Unit
@@ -55,7 +55,7 @@ func (v Volume) Volume() Volume {
// From converts the unit into the receiver. From returns an
// error if there is a mismatch in dimension
func (v *Volume) From(u Uniter) error {
- if !DimensionsMatch(u, Liter) {
+ if !DimensionsMatch(u, Litre) {
*v = Volume(math.NaN())
return errors.New("Dimension mismatch")
}

unit: use SI spelling for SI units