2
0
Эх сурвалжийг харах

* Initial version

git-svn-id: trunk@4919 -
marco 19 жил өмнө
parent
commit
d3dfdffaa2
2 өөрчлөгдсөн 53 нэмэгдсэн , 0 устгасан
  1. 1 0
      .gitattributes
  2. 52 0
      rtl/objpas/stdconvs.pp

+ 1 - 0
.gitattributes

@@ -4840,6 +4840,7 @@ rtl/objpas/objpas.pp svneol=native#text/plain
 rtl/objpas/rtlconst.inc svneol=native#text/plain
 rtl/objpas/rtlconst.pp svneol=native#text/plain
 rtl/objpas/rtlconsts.pp svneol=native#text/plain
+rtl/objpas/stdconvs.pp svneol=native#text/plain
 rtl/objpas/strutils.pp svneol=native#text/plain
 rtl/objpas/sysconst.pp svneol=native#text/plain
 rtl/objpas/sysutils/dati.inc svneol=native#text/plain

+ 52 - 0
rtl/objpas/stdconvs.pp

@@ -0,0 +1,52 @@
+{
+   This file is part of the Free Pascal run time library.
+   Copyright (c) 2004 by Marco van de Voort
+   member of the Free Pascal development team.
+
+   An implementation for unit stdconv, 
+
+   Based on list of function of delphibasics.co.uk and #7482.
+
+   Quantities are mostly taken from my HP48g/gx or the unix units program
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY;without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+**********************************************************************}
+
+unit stdconvs;
+
+interface
+
+{$mode objfpc}
+{$H+}
+
+function CelsiusToFahrenheit(const AValue: Double): Double;
+function FahrenheitToCelsius(const AValue: Double): Double;
+function CelsiusToKelvin    (const AValue: Double): Double;
+function KelvinToCelsius    (const AValue: Double): Double;
+
+implementation
+
+function FahrenheitToCelsius(const AValue: Double): Double;
+begin
+  result:= 32.0 + ((9.0 * AValue)/ 5.0);
+end;
+
+function CelsiusToFahrenheit(const AValue: Double): Double;
+begin
+  result:= (5.0/9.0)  * (Avalue - 32.0);
+end;
+
+function CelsiusToKelvin    (const AValue: Double): Double;
+begin
+  result:=AValue+273.15;
+end;
+
+function KelvinToCelsius    (const AValue: Double): Double;
+begin
+  result:=AValue-273.15;
+end;
+
+end.