Skip to content

Commit

Permalink
Add bitcoin unit conversion, add more gram conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Kundert authored and Ken Kundert committed Jan 6, 2022
1 parent 81dd18e commit 2c48bca
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
1 change: 1 addition & 0 deletions doc/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,7 @@ like the following:

.. image:: flicker.svg


.. cryptocurrency example {{{1
.. _quantiphy cryptocurrency example:

Expand Down
19 changes: 10 additions & 9 deletions doc/user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -544,15 +544,16 @@ consistent units. For example:
QuantiPhy* provides a collection of pre-defined converters for common units:

====== ================================================================
K: K, F °F, R °R
C °C: K, C °C, F °F, R °R
m: km, m, cm, mm, um μm micron, nm, Å angstrom, mi mile miles,
in inch inches
g: oz, lb lbs
s: sec second seconds, min minute minutes, hour hours hr, day days
b: B
====== ================================================================
=========== ================================================================
C °C K, F °F, R °R
K C °C, F °F, R °R
m km, m, cm, mm, um μm micron, nm, Å angstrom, mi mile miles,
in inch inches
g kg, mg, ug μg, ng, oz, lb lbs
s sec second seconds, min minute minutes, hour hours hr, day days
b B
BTC btc Ƀ ₿ sat sats ș
=========== ================================================================

The conversions can occur between a pair of units, one from the first column and
one from the second. They do not occur when both units are only in the second
Expand Down
8 changes: 7 additions & 1 deletion quantiphy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3304,7 +3304,6 @@ def __str__(self):


# Temperature conversions {{{2
UnitConversion('C °C', 'C °C')
UnitConversion('C °C', 'K', 1, -273.15)
UnitConversion('C °C', 'F °F', 5/9, -32*5/9)
UnitConversion('C °C', 'R °R', 5/9, -273.15)
Expand All @@ -3326,6 +3325,10 @@ def __str__(self):
# Mass conversions {{{2
UnitConversion('g', 'lb lbs', 453.59237)
UnitConversion('g', 'oz', 28.34952)
UnitConversion('g', 'kg', 1000)
UnitConversion('g', 'mg', 1/1000)
UnitConversion('g', 'ug µg μg', 1/1000000)
UnitConversion('g', 'ng', 1/1000000000)

# Time conversions {{{2
UnitConversion('s', 'sec second seconds')
Expand All @@ -3335,3 +3338,6 @@ def __str__(self):

# Bit conversions {{{2
UnitConversion('b', 'B', 8)

# Bitcoin conversions {{{2
UnitConversion(['sat', 'sats', 'ș'], ['BTC', 'btc', 'Ƀ', '₿'], 1e8)

0 comments on commit 2c48bca

Please sign in to comment.