xo-unit: + abbrevs + tests for imperial units {in,ft,yd,mi}
This commit is contained in:
parent
5f20b53485
commit
f4c1ef5ee6
2 changed files with 17 additions and 0 deletions
|
|
@ -114,9 +114,21 @@ namespace xo {
|
|||
return bu_abbrev_type::from_chars("AU");
|
||||
}
|
||||
}
|
||||
|
||||
if (scalefactor.den() == 10000) {
|
||||
switch(scalefactor.num()) {
|
||||
case 3048:
|
||||
return bu_abbrev_type::from_chars("ft");
|
||||
case 3*3048:
|
||||
return bu_abbrev_type::from_chars("yd");
|
||||
case 5280*3048:
|
||||
return bu_abbrev_type::from_chars("mi");
|
||||
}
|
||||
}
|
||||
|
||||
if (scalefactor.num() == 3048 && scalefactor.den() == 120000)
|
||||
return bu_abbrev_type::from_chars("in");
|
||||
|
||||
return fallback_unit_abbrev(scalefactor, dimension::distance);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue