I found that using cast(round(x * 100) as integer) will give me
result I want.

Thank you !
RA

----- Original Message ----- 
From: "D. Richard Hipp" <[EMAIL PROTECTED]>
To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org>
Sent: Saturday, July 12, 2008 10:54 PM
Subject: Re: [sqlite] Using real


>
> On Jul 12, 2008, at 4:41 PM, Radovan Antloga wrote:
>
>> please check this sql:
>>
>> select cast((2.3 * 100) as integer), cast(round(2.3 * 100) as
>> integer), 2.3 * 100, cast(230.0 as integer)
>>
>> Is this proper behaviour ?
>>
>
> Yes it is.  The CASE(* AS INTEGER) operation rounds toward zero.  And
> 2.3*100.0 in IEEE float notation is
> 229.999999999999971578290569595992565155029296875 which when rounded
> toward zero yields 229.
>
> See also http://www.sqlite.org/faq.html#q16
>
> D. Richard Hipp
> [EMAIL PROTECTED]
>
>
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
> __________ NOD32 3263 (20080711) Informacija __________
>
> To sporoèilo je preveril protivirusni sistem NOD32.
> http://www.nod32.com
>
> 

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to