Skip to content

Commit

Permalink
Add decibel unit, add microsecond shortcut.
Browse files Browse the repository at this point in the history
  • Loading branch information
LabordePierre committed Nov 6, 2024
1 parent e975122 commit fabf534
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Units-Core/NamedUnit.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,13 @@ NamedUnit class >> initializeOtherUnits [
name: 'watt'
pluralName: 'watts'
value: (1 units: ((Unit ampere) * (Unit volt))).

self
abbreviation: 'dB'
name: 'decibel'
pluralName: 'decibels'
value: ((10 raisedTo: ((1 - 30) / 10)) units: Unit watt).
self flag:'labordep: how to convert this unit to watt because this is not a *?'.

DerivedUnit
abbreviation: 'deg'
name: 'arcdegree'
Expand Down
12 changes: 12 additions & 0 deletions src/Units-Core/Number.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,18 @@ Number >> cm [
^self units: #centimeter
]

{ #category : '*Units-Core' }
Number >> dB [

^ self decibel
]

{ #category : '*Units-Core' }
Number >> decibel [

^ self units: #decibel
]

{ #category : '*Units-Core' }
Number >> degreeCelsius [

Expand Down
18 changes: 18 additions & 0 deletions src/Units-Core/Unit.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ Unit class >> coulombs [
^self coulomb
]

{ #category : 'power units' }
Unit class >> dB [

^ self decibel
]

{ #category : 'time units' }
Unit class >> day [

Expand All @@ -199,6 +205,12 @@ Unit class >> days [
^ self day
]

{ #category : 'power units' }
Unit class >> decibel [

^ NamedUnit named: 'decibel'
]

{ #category : 'miscellaneous units' }
Unit class >> deg [

Expand Down Expand Up @@ -595,6 +607,12 @@ Unit class >> micrograms [
^self microgram
]

{ #category : 'time units' }
Unit class >> microsecond [

^ self microseconds
]

{ #category : 'time units' }
Unit class >> microseconds [

Expand Down

0 comments on commit fabf534

Please sign in to comment.