-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Situation: I want to define "quart".
This is currently how I have to do it.
public static let quart = try! Units.Unit.register(
name: "quart",
symbol: "qt",
dimension: [.Length: 3],
coefficient: 0.0009463529 // This is the conversion to kiloliters
)Problem:
- It was not obvious to me that the
coefficientshould be the scalar conversion to kiloliters. I had to dig around the list of defined units to find the[.Length: 3]one withcoefficient: 1. - Then I had to Google "quart to kiloliter" which gave me this long coefficient that I'm not sure how accurate it is. But I already know that a quart is 1/4 gallon (exactly).
Desired Solution:
extension Unit {
public static let quart = try! Units.Unit.register(
name: "quart",
symbol: "qt",
derivation: 0.25 * .gallon
)
}Metadata
Metadata
Assignees
Labels
No labels