Bläddra i källkod

+ comp and int64 overloads for floattostr(f)

git-svn-id: trunk@2403 -
Jonas Maebe 19 år sedan
förälder
incheckning
7338c03fac
2 ändrade filer med 34 tillägg och 0 borttagningar
  1. 26 0
      rtl/objpas/sysutils/sysstr.inc
  2. 8 0
      rtl/objpas/sysutils/sysstrh.inc

+ 26 - 0
rtl/objpas/sysutils/sysstr.inc

@@ -1235,6 +1235,19 @@ Begin
   Result := FloatToStrFIntl(Value, ffGeneral, 15, 0, fvSingle);
   Result := FloatToStrFIntl(Value, ffGeneral, 15, 0, fvSingle);
 End;
 End;
 
 
+Function FloatToStr(Value: Comp): String;
+Begin
+  Result := FloatToStrFIntl(Value, ffGeneral, 15, 0, fvComp);
+End;
+
+{$ifndef FPC_COMP_IS_INT64}
+Function FloatToStr(Value: Int64): String;
+Begin
+  Result := FloatToStrFIntl(Comp(Value), ffGeneral, 15, 0, fvComp);
+End;
+{$endif FPC_COMP_IS_INT64}
+
+
 Function FloatToText(Buffer: PChar; Value: Extended; format: TFloatFormat; Precision, Digits: Integer): Longint;
 Function FloatToText(Buffer: PChar; Value: Extended; format: TFloatFormat; Precision, Digits: Integer): Longint;
 Var
 Var
   Tmp: String[40];
   Tmp: String[40];
@@ -1266,12 +1279,25 @@ begin
   result := FloatToStrFIntl(value,format,precision,digits,fvSingle);
   result := FloatToStrFIntl(value,format,precision,digits,fvSingle);
 end;
 end;
 
 
+Function FloatToStrF(Value: Comp; format: TFloatFormat; Precision, Digits: Integer): String;
+begin
+  result := FloatToStrFIntl(value,format,precision,digits,fvComp);
+end;
+
+{$ifndef FPC_COMP_IS_INT64}
+Function FloatToStrF(Value: Int64; format: TFloatFormat; Precision, Digits: Integer): String;
+begin
+  result := FloatToStrFIntl(Comp(value),format,precision,digits,fvComp);
+end;
+{$endif FPC_COMP_IS_INT64}
+
 
 
 Function CurrToStrF(Value: Currency; Format: TFloatFormat; Digits: Integer): string;
 Function CurrToStrF(Value: Currency; Format: TFloatFormat; Digits: Integer): string;
   begin
   begin
     result:=FloatToStrF(Value,Format,19,Digits);
     result:=FloatToStrF(Value,Format,19,Digits);
   end;
   end;
 
 
+
 Function FloatToDateTime (Const Value : Extended) : TDateTime;
 Function FloatToDateTime (Const Value : Extended) : TDateTime;
 begin
 begin
   If (Value<MinDateTime) or (Value>MaxDateTime) then
   If (Value<MinDateTime) or (Value>MaxDateTime) then

+ 8 - 0
rtl/objpas/sysutils/sysstrh.inc

@@ -124,7 +124,11 @@ Function FloatToStrF(Value: Extended; format: TFloatFormat; Precision, Digits: I
 {$endif FPC_HAS_TYPE_EXTENDED}
 {$endif FPC_HAS_TYPE_EXTENDED}
 Function FloatToStrF(Value: Double; format: TFloatFormat; Precision, Digits: Integer): String;
 Function FloatToStrF(Value: Double; format: TFloatFormat; Precision, Digits: Integer): String;
 Function FloatToStrF(Value: Single; format: TFloatFormat; Precision, Digits: Integer): String;
 Function FloatToStrF(Value: Single; format: TFloatFormat; Precision, Digits: Integer): String;
+Function FloatToStrF(Value: Comp; format: TFloatFormat; Precision, Digits: Integer): String;
 Function FloatToStrF(Value: Currency; format: TFloatFormat; Precision, Digits: Integer): String;
 Function FloatToStrF(Value: Currency; format: TFloatFormat; Precision, Digits: Integer): String;
+{$ifndef FPC_COMP_IS_INT64}
+Function FloatToStrF(Value: Int64; format: TFloatFormat; Precision, Digits: Integer): String;
+{$endif FPC_COMP_IS_INT64}
 Function CurrToStrF(Value: Currency; Format: TFloatFormat; Digits: Integer): string;
 Function CurrToStrF(Value: Currency; Format: TFloatFormat; Digits: Integer): string;
 {$ifdef FPC_HAS_TYPE_EXTENDED}
 {$ifdef FPC_HAS_TYPE_EXTENDED}
 Function FloatToStr(Value: Extended): String;
 Function FloatToStr(Value: Extended): String;
@@ -132,6 +136,10 @@ Function FloatToStr(Value: Extended): String;
 Function FloatToStr(Value: Double): String;
 Function FloatToStr(Value: Double): String;
 Function FloatToStr(Value: Single): String;
 Function FloatToStr(Value: Single): String;
 Function FloatToStr(Value: Currency): String;
 Function FloatToStr(Value: Currency): String;
+Function FloatToStr(Value: Comp): String;
+{$ifndef FPC_COMP_IS_INT64}
+Function FloatToStr(Value: Int64): String;
+{$endif FPC_COMP_IS_INT64}
 Function StrToFloat(Const S : String) : Extended;
 Function StrToFloat(Const S : String) : Extended;
 Function StrToFloatDef(Const S: String; Const Default: Extended): Extended;
 Function StrToFloatDef(Const S: String; Const Default: Extended): Extended;
 Function TryStrToFloat(Const S : String; Var Value: Single): Boolean;
 Function TryStrToFloat(Const S : String; Var Value: Single): Boolean;