source: trunk/src/core/RpUnitsStd.cc @ 20

Last change on this file since 20 was 20, checked in by dkearney, 17 years ago

initial submission of the Rappture Core components and language bindings

File size: 2.2 KB
Line 
1#ifdef __cplusplus
2extern "C" {
3#endif
4
5/****************************************
6 * METRIC CONVERSIONS
7 ****************************************/
8
9double centi2base (double centi)
10{
11   return centi*1e-2;   
12}
13
14double milli2base (double milli)
15{
16    return milli*1e-3;
17}
18
19double micro2base (double micro)
20{
21    return micro*1e-6;
22}
23
24double nano2base (double nano)
25{
26    return nano*1e-9;
27}
28
29double pico2base (double pico)
30{
31    return pico*1e-12;
32}
33
34double femto2base (double femto)
35{
36    return femto*1e-15;
37}
38
39double atto2base (double atto)
40{
41    return atto*1e-18;
42}
43
44double kilo2base (double kilo)
45{
46    return kilo*1e3;
47}
48
49double mega2base (double mega)
50{
51    return mega*1e6;
52}
53
54double giga2base (double giga)
55{
56    return giga*1e9;
57}
58
59double tera2base (double tera)
60{
61    return tera*1e12;
62}
63
64double peta2base (double peta)
65{
66    return peta*1e15;
67}
68
69double base2centi (double base)
70{
71    return base*1e2;   
72}
73
74double base2milli (double base)
75{
76    return base*1e3;
77}
78
79double base2micro (double base)
80{
81    return base*1e6;
82}
83
84double base2nano (double base)
85{
86    return base*1e9;
87}
88
89double base2pico (double base)
90{
91    return base*1e12;
92}
93
94double base2femto (double base)
95{
96    return base*1e15;
97}
98
99double base2atto (double base)
100{
101    return base*1e18;
102}
103
104double base2kilo (double base)
105{
106    return base*1e-3;
107}
108
109double base2mega (double base)
110{
111    return base*1e-6;
112}
113
114double base2giga (double base)
115{
116    return base*1e-9;
117}
118
119double base2tera (double base)
120{
121    return base*1e-12;
122}
123
124double base2peta (double base)
125{
126    return base*1e-15;
127}
128
129
130
131/****************************************
132 * METRIC TO NON-METRIC CONVERSIONS
133 ****************************************/
134
135double angstrom2meter (double angstrom)
136{
137        return angstrom*1.0e-10;
138}
139
140double meter2angstrom (double meters)
141{
142        return meters*1.0e10;
143}
144
145/****************************************
146 * TEMPERATURE CONVERSIONS
147 ****************************************/
148
149double fahrenheit2centigrade (double F)
150{
151        return ((F-32.0)/(9.0/5.0));
152}
153
154double centigrade2fahrenheit (double C)
155{
156        return ((C*(9.0/5.0))+32.0);
157}
158
159double centigrade2kelvin (double C)
160{
161        return (C+273.15);
162}
163
164double kelvin2centigrade (double K)
165{
166        return (K-273.15);
167}
168
169
170#ifdef __cplusplus
171}
172#endif
Note: See TracBrowser for help on using the repository browser.