units 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. .TH UNITS 1
  2. .if n .ds / /
  3. .SH NAME
  4. units \- conversion program
  5. .SH SYNOPSIS
  6. .B units
  7. [
  8. .B -v
  9. ]
  10. [
  11. .I file
  12. ]
  13. .SH DESCRIPTION
  14. .I Units
  15. converts quantities expressed
  16. in various standard scales to
  17. their equivalents in other scales.
  18. It works interactively in this fashion:
  19. .IP
  20. .EX
  21. you have: inch
  22. you want: cm
  23. * 2.54
  24. / 0.393701
  25. .EE
  26. .PP
  27. A quantity is specified as a multiplicative combination
  28. of units and floating point numbers.
  29. Operators have the following precedence:
  30. .IP
  31. .EX
  32. .ta \w'\fLXXXXXXXXXXXXXXX'u
  33. \fL+\fP \fL-\fP \f1add and subtract
  34. \fL*\fP \fL/\fP \fL×\fP \fL÷\fP \f1multiply and divide
  35. catenation multiply
  36. \fL²\fP \fL³\fP \fL^\fP \f1exponentiation
  37. \fL|\fP \f1divide
  38. \fL(\fP ... \fL)\fP \f1grouping
  39. .EE
  40. .PP
  41. Most familiar units,
  42. abbreviations, and metric prefixes are recognized,
  43. together with a generous leavening of exotica
  44. and a few constants of nature including:
  45. .IP
  46. .de fq
  47. \fL\\$1\\fP \\$2 \\$3 \\$4 \\$5 \\$6
  48. ..
  49. .ta \w'\fLwaterXXX'u
  50. .nf
  51. .fq pi,\f1π\fP ratio of circumference to diameter
  52. .fq c speed of light
  53. .fq e charge on an electron
  54. .fq g acceleration of gravity
  55. .fq force same as \fLg\fP
  56. .fq mole Avogadro's number
  57. .fq water "pressure head per unit height of water"
  58. .fq au astronomical unit
  59. .fi
  60. .PP
  61. The
  62. .L pound
  63. is a unit of
  64. mass.
  65. Compound names are run together, e.g.
  66. .LR lightyear .
  67. British units that differ from their US counterparts
  68. are prefixed thus:
  69. .LR brgallon .
  70. Currency is denoted
  71. .LR belgiumfranc ,
  72. .LR britainpound ,
  73. etc.
  74. .PP
  75. The complete list of units can be found in
  76. .BR /lib/units .
  77. A
  78. .I file
  79. argument to
  80. .I units
  81. specifies a file to be used instead of
  82. .BR /lib/units.
  83. The
  84. .B -v
  85. flag causes
  86. .I units
  87. to print its entire database.
  88. .SH EXAMPLE
  89. .EX
  90. you have: 15 pounds force/in²
  91. you want: atm
  92. * 1.02069
  93. / .97973
  94. .EE
  95. .SH FILES
  96. .B /lib/units
  97. .SH SOURCE
  98. .B /sys/src/cmd/units.y
  99. .SH BUGS
  100. Since
  101. .I units
  102. does only multiplicative scale changes,
  103. it can convert Kelvin to Rankine but not Centigrade to
  104. Fahrenheit.
  105. .PP
  106. Currency conversions are only as accurate as the last time someone
  107. updated the database.