Re: [sqlite] Newbie: round function

2009-03-18 Thread Edesio Costa e Silva
Thaks for the workaround.

But according to the documentation, round(3.1416) should return zero digits
to the right of the decimal point. I checked with mysql:

$ mysql
Server version: 5.0.51a-3ubuntu5.4 (Ubuntu)

mysql> select round(3.1416);
+---+
| round(3.1416) |
+---+
| 3 | 
+---+
1 row in set (0.02 sec)

Thanks again.

Edésio

On Wed, Mar 18, 2009 at 12:05:06PM -0500, Jim Wilcoxson wrote:
> Well, it doesn't exactly say that an integer is returned.  round()
> always returns a float:
> 
> sqlite> select typeof(3);
> typeof(3)
> --
> integer
> 
> sqlite> select typeof(round(3));
> typeof(round(3))
> 
> real
> sqlite>
> 
> You can do this:
> 
> sqlite> select typeof(cast(round(3.14) as integer));
> typeof(cast(round(3.14) as integer))
> 
> integer
> sqlite>
> 
> Jim
> 
> On 3/18/09, sqlite.20.ede...@spamgourmet.com
>  wrote:
> > Hi!
> >
> > Is this expected?
> >
> > $ sqlite3
> > SQLite version 3.6.10
> > Enter ".help"for instructions
> > Enter SQL statements terminated with a ";"
> > sqlite> select round(3.1416);
> > 3.0
> > CPU Time: user 0.00 sys 0.00
> > sqlite>
> >
> > I expected an integer 3 as documented:
> >
> > round(X)
> > round(X,Y)  Round off the number X to Y digits to the right of the
> > decimal point. If the Y argument is omitted, 0 is assumed.
> >
> > Thanks in advance.
> >
> > Edésio
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
> 
> 
> -- 
> Software first.  Software lasts!
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Newbie: round function

2009-03-18 Thread Jim Wilcoxson
Well, it doesn't exactly say that an integer is returned.  round()
always returns a float:

sqlite> select typeof(3);
typeof(3)
--
integer

sqlite> select typeof(round(3));
typeof(round(3))

real
sqlite>

You can do this:

sqlite> select typeof(cast(round(3.14) as integer));
typeof(cast(round(3.14) as integer))

integer
sqlite>

Jim

On 3/18/09, sqlite.20.ede...@spamgourmet.com
 wrote:
> Hi!
>
> Is this expected?
>
> $ sqlite3
> SQLite version 3.6.10
> Enter ".help"for instructions
> Enter SQL statements terminated with a ";"
> sqlite> select round(3.1416);
> 3.0
> CPU Time: user 0.00 sys 0.00
> sqlite>
>
> I expected an integer 3 as documented:
>
> round(X)
> round(X,Y)Round off the number X to Y digits to the right of the
> decimal point. If the Y argument is omitted, 0 is assumed.
>
> Thanks in advance.
>
> Edésio
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
Software first.  Software lasts!
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Newbie: round function

2009-03-18 Thread sqlite . 20 . edesio
Hi!

Is this expected?

$ sqlite3
SQLite version 3.6.10
Enter ".help"for instructions
Enter SQL statements terminated with a ";"
sqlite> select round(3.1416);
3.0
CPU Time: user 0.00 sys 0.00
sqlite> 

I expected an integer 3 as documented:

round(X)
round(X,Y)  Round off the number X to Y digits to the right of the
decimal point. If the Y argument is omitted, 0 is assumed.

Thanks in advance.

Edésio
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users