Subject Re: Truncate a double precision number
Author Alexander V.Nevsky
--- In, "Arn" <arn@f...> wrote:
> Hi All.
> I am doing some big calculations in Firebird, so I must use double
> to avoid complains from Firebird.
> 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.

If in SP, perhaps something like (not checked):

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
String=Cast(Cast(Int_Part||'.'||Float_Part As VarChar(18)) As Numeric


Best regards,