stdconvs.pp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2004 by Marco van de Voort
  4. member of the Free Pascal development team.
  5. An implementation for unit stdconv,
  6. Based on list of function of delphibasics.co.uk and #7482.
  7. Quantities are mostly taken from my HP48g/gx or the unix units program
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY;without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. unit stdconvs;
  13. interface
  14. {$mode objfpc}
  15. {$H+}
  16. function CelsiusToFahrenheit(const AValue: Double): Double;
  17. function FahrenheitToCelsius(const AValue: Double): Double;
  18. function CelsiusToKelvin (const AValue: Double): Double;
  19. function KelvinToCelsius (const AValue: Double): Double;
  20. implementation
  21. function FahrenheitToCelsius(const AValue: Double): Double;
  22. begin
  23. result:= 32.0 + ((9.0 * AValue)/ 5.0);
  24. end;
  25. function CelsiusToFahrenheit(const AValue: Double): Double;
  26. begin
  27. result:= (5.0/9.0) * (Avalue - 32.0);
  28. end;
  29. function CelsiusToKelvin (const AValue: Double): Double;
  30. begin
  31. result:=AValue+273.15;
  32. end;
  33. function KelvinToCelsius (const AValue: Double): Double;
  34. begin
  35. result:=AValue-273.15;
  36. end;
  37. end.