Subject Re: About UDF's problem
Author Yang Jin
So fast reply! Thank you very much.
It's right.I had tried it after post the problem,had the same reuslt that you example.
I can also understand your explain.But the field's datatype in Table is numeric(18,9),the Field value in Table is 13.275000000, of course display as 13.275 in 3dp.So I still not understand,
why cast( 13.275000000 as numeric(18,2)) = 13.27,but
cast( 13.275 as numeric(18,2)) = 13.28?
Other info: the result of cast( 13.275000000 as numeric(18,1)) = 13.3, I can accept it.
Thanks again.

regrads.
Adam <s3057043@...> 写道:
--- 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







++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://firebird.sourceforge.net and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




SPONSORED LINKS
Technical support Computer security Computer technical support Computer training Free computer technical support

---------------------------------
YAHOO! GROUPS LINKS


Visit your group "firebird-support" on the web.

To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


---------------------------------




---------------------------------
DO YOU YAHOO!?
雅虎免费G邮箱-中国第一绝无垃圾邮件骚扰超大邮箱

[Non-text portions of this message have been removed]