Subject Re: About UDF's problem
Author Adam
--- In firebird-support@yahoogroups.com, Yang Jin <ojinyang@y...> wrote:
> Thanks.
> But a new problem found.
> Cast (Value1 as numeric(9,2)),Value1= 13.275,reuslt is 13.27;
> Cast (Value2 as numeric(9,2)),Value2= 13.228,reuslt is 13.23;
> what is the rule to round?
>

I am getting a slightly different result in iSQL

SQL> select cast(13.275 as numeric(9,2)) from rdb$database;

CAST
============

13.28

SQL> select cast(13.228 as numeric(9,2)) from rdb$database;

CAST
============

13.23

Both of which look reasonable to me. Perhaps Value1 is not what you
think it is? It could reasonably be 13.2749999999, which would be
rounded correctly to 13.27, but it may round it to 13.275 when it
displays it in 3dp.


Adam