Re: CODE : Temprature Conversion
- Posted by Lmailles at AOL.COM Jun 11, 1998
- 740 views
Matt Hounsell added to Carl White's temperature routines. For those of you who care, I have tweaked them a little. 0 celsius is actually 273.15 K. > function FtoC(atom farenheit) --Here I replace a divide with a multiply > return (farenheit - 32) * .555555 > end function > > function CtoF(atom celcius) -- or centigrade if you want > return celcius * 1.8 + 32 > end function > > Here are 4 functions to complement these, > K stands for Kelvin (Standard Unit for Temperature) a system that starts at > absolute zero and uses the same scale as Celcius. > > function CtoK(atom celcius) --This was previously a - and is now correctly a + (0 Celsius = 273.15 K) > return celcius + 273.15 > end function > > function FtoK(atom farenheit) --Ditto here > return ( (farenheit - 32) * .555555 ) + 273.15 > end function > > function KtoC(atom kelvin) --Ooops ! They were all wrong ! Sorry Mat > return kelvin - 273.15 > end function > > function KtoF(atom kelvin) --Plus Einar's correction here > return ( kelvin - 273.15) * 1.8 + 32 > end function "Can you live a moment longer by worrying about it ?" Daniel