Temperature conversion: Difference between revisions
Content deleted Content added
m →{{header|REXX}}: output needs updating... -- ~~~~ |
→{{header|REXX}}: added other temperature scales to the REXX program, added a nit at the bottom of the output. -- ~~~~ |
||
Line 240:
* (alternate spellings with optional ''degrees''):
** Centingrade, centesimal, Celsius, Celcius
** Delisle
** Fahrenheit
** Kelvin
** Newton
** Rankine
** Reaumur, Réaumur
** Romer (Romer)
* multiple temperatures in a list
* comments within the list
* aligned output (whole numbers and decimal fractions)
<lang rexx>/*REXX program converts
parse arg tList /*get specified temperature lists*/
Line 264 ⟶ 267:
uU=u; upper uU /*uppercase version of temp unit.*/
if left(uU,7)=='DEGREES' then uU=substr(uU,8) /*
if left(uU,5)=='DEGREE' then uU=substr(uU,7) /*
uU=strip(uU)
if \datatype(n,'N') then call serr 'illegal number:' n
/*accept alternate spellings. */
select
when abbrev('RANKINE' , uU) then F=n
when abbrev('REAUMUR' , uU, 2) then F=n
when abbrev('RéAUMUR' , uU, 2) |,
abbrev('RÉAUMUR' , uU, 2) |,
abbrev('REAUMUR' , uU, 2) then F=n * 9/4 + 32
when abbrev('ROMER' , uU, 2) then F=(n-7.5) * 27/4 + 32
otherwise call serr 'illegal temperature scale:' u
end /*select*/
say right(' ' x,55,"─")
say Tform((F - 32) * 5/9
say Tform(
say Tform(
say Tform(
say Tform((F - 32 ) * 11/60
say Tform( F + 459.67 ) 'Rankine'
say Tform((F - 32 ) * 4/9 ) 'Reaumur'
say Tform((F - 32 ) * 7/24 + 7.5) 'Romer'
end /*until tlist=''*/
Line 297 ⟶ 309:
'''output''' when using the input of: <tt> -40C, 0 c (water freezes), 37C (body temp), 100 C (water boils), 21 degrees Kelvin, 0K (outer space?) </tt>
<pre style="overflow:scroll">
───────────────────────────────────────────────── -40C
-40 Celcius
210 Delisle
-40 Fahrenheit
233.15 Kelvin
-13.2 Newton
419.67 Rankine
-32 Reaumur
-13.5 Romer
─────────────────────────────────── 0c (water freezes)
0 Celcius
150 Delisle
32 Fahrenheit
273.15 Kelvin
0 Newton
491.67 Rankine
0 Reaumur
7.5 Romer
────────────────────────────────────── 37C (body temp)
37 Celcius
94.5 Delisle
98.6 Fahrenheit
310.15 Kelvin
12.21 Newton
558.27 Rankine
29.6 Reaumur
26.925 Romer
─────────────────────────────────── 100c (water boils)
100 Celcius
0 Delisle
212 Fahrenheit
373.15 Kelvin
33 Newton
671.67 Rankine
80 Reaumur
60 Romer
──────────────────────────────────── 21 degrees Kelvin
-252.15 Celcius
528.225 Delisle
-421.87 Fahrenheit
21 Kelvin
-83.21 Newton
37.8 Rankine
-201.72 Reaumur
-124.879 Romer
──────────────────────────────────── 0K (outer space?)
-273.15 Celcius
559.725 Delisle
-459.67 Fahrenheit
0 Kelvin
-90.14 Newton
0 Rankine
-218.52 Reaumur
-135.904 Romer
</pre>
[Actually, water freezes at 0.000089 ºC, and boils at 99.974 ºC.]
<br><br>
|