1. CODE : Temprature Conversion
- Posted by Mathew Hounsell <mat.hounsell at MAILEXCITE.COM> Jun 10, 1998
- 738 views
Carl R. White sent the following functions to the list : function FtoC(atom farenheit) return (farenheit - 32) / 1.8 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) return celcius - 273 end function function FtoK(atom farenheit) return ( (farenheit - 32) / 1.8 ) - 273 end function function KtoC(atom kelvin) return kelvin + 273 end function function KtoF(atom Kelvin) return ( celcius + 273) * 1.8 + 32 end function --- Sincerely, Mathew Hounsell Mat.Hounsell at mailexcite.com Free web-based email, Forever, From anywhere! http://www.mailexcite.com
2. Re: CODE : Temprature Conversion
- Posted by Einar Mogen <nord.staernes at ROLLAG.MAIL.TELIA.COM> Jun 10, 1998
- 740 views
>function KtoF(atom Kelvin) > return ( celcius + 273) * 1.8 + 32 >end function Guess you typed this directly, this one should probably read: function KtoF(atom kelvin) return (kelvin + 273) * 1.8 + 32 end function Einar Mogen
3. Re: CODE : Temprature Conversion
- Posted by Lmailles at AOL.COM Jun 11, 1998
- 743 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