Subject | Re: Truncate a double precision number |
---|---|
Author | Alexander V.Nevsky |
Post date | 2004-03-27T13:51:55Z |
--- In firebird-support@yahoogroups.com, "Arn" <arn@f...> wrote:
Int_Part=Cast(floor(Your_Number) As Int);
Float_Part=Cast(Cast(floor(Your_Number-Int_Part)*100000 As Int) As
VarChar (5));
While (StrLen(Float_Part)<5) Do
Float_Part='0'||Float_Part;
String=Cast(Cast(Int_Part||'.'||Float_Part As VarChar(18)) As Numeric
(18,5))
?
Best regards,
Alexander
> Hi All.precision
>
> I am doing some big calculations in Firebird, so I must use double
> to avoid complains from Firebird.If in SP, perhaps something like (not checked):
> All fine, but I got results of 13 decimal point.
> I NEED this number with only 5 decimals, but without rounding eg:
> 0.0283276457249 should be 0.02832.
>
> Someone want tell Me ho to truncate withaut rounding?
> In UDF I cannot find the right command.
Int_Part=Cast(floor(Your_Number) As Int);
Float_Part=Cast(Cast(floor(Your_Number-Int_Part)*100000 As Int) As
VarChar (5));
While (StrLen(Float_Part)<5) Do
Float_Part='0'||Float_Part;
String=Cast(Cast(Int_Part||'.'||Float_Part As VarChar(18)) As Numeric
(18,5))
?
Best regards,
Alexander