Anonymous user
Temperature conversion: Difference between revisions
m
→{{header|REXX}}: simplified uppercasing of some none-Latin characters, added whitespace. -- ~~~~
m (→{{header|REXX}}: added whitespace. -- ~~~~) |
m (→{{header|REXX}}: simplified uppercasing of some none-Latin characters, added whitespace. -- ~~~~) |
||
Line 257:
x=space(x); parse var x z '(' /*handle any comments (if any). */
if z=='' then call serr 'no arguments were specified.'
_
if _\==0 then do
if _==1 then call serr 'illegal temperature:' #
n=
u=
end
else u=
uU=translate(u,'EE',"éÉ"); upper uU
if left(uU,7)=='DEGREES' then uU=substr(uU,8) /*redundant "degrees"? */
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 /*convert ──► ºF temperatures. */
when abbrev('CENTIGRADE', uU) |,
abbrev('CENTESIMAL', uU) |,
abbrev('CELSIUS' , uU) |,
abbrev('CELCIUS' , uU) then F=n * 9/5 + 32
when abbrev('DELISLE' , uU) then F=212 -(n * 6/5)
Line 283:
when abbrev('RANKINE' , uU) then F=n - 459.67
when abbrev('REAUMUR' , uU, 2) then F=n * 9/4 + 32
when abbrev('ROEMER' , uU, 2) |,
abbrev('ROMER' , uU, 2) then F=(n-7.5) * 27/4 + 32
Line 291 ⟶ 288:
end /*select*/
say right(' ' x,55,"─")
say Tform( ( F - 32
say Tform( ( 212 - F
say Tform( F ) 'Fahrenheit'
say Tform( ( F + 459.67 ) * 5/9 ) 'Kelvin'
say Tform( ( F - 32 ) * 11/60 ) 'Newton'
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=''*/
|