hedgewars/uFloat.pas
changeset 5151 cbadb9fa52fc
parent 5124 84267f79879b
child 5192 881c14f81d12
--- a/hedgewars/uFloat.pas	Sun Apr 17 11:57:46 2011 -0400
+++ b/hedgewars/uFloat.pas	Sun Apr 17 12:48:32 2011 -0400
@@ -58,6 +58,7 @@
 
 // Returns an hwFloat that represents the value of integer parameter i
 function int2hwFloat (const i: LongInt) : hwFloat; inline;
+function hwFloat2Float (const i: hwFloat) : extended; inline;
 
 // The implemented operators
 
@@ -188,6 +189,12 @@
 int2hwFloat.Frac:= 0
 end;
 
+function hwFloat2Float (const i: hwFloat) : extended;
+begin
+hwFloat2Float:= i.QWordValue / $100000000;
+if i.isNegative then hwFloat2Float:=hwFloat2Float*-1;
+end;
+
 operator + (const z1, z2: hwFloat) z : hwFloat;
 begin
 if z1.isNegative = z2.isNegative then