Discussion:
[sqlite] Implement floor and ceil functions
Artem Skoretskiy
2015-07-24 13:15:00 UTC
Permalink
Hi all,

According to the documentation https://www.sqlite.org/lang_corefunc.html
SQLite does not provide some basic math functions such as floor and ceil.
They are pretty handy additions for "round" function that is present.

For me as developer it would be great to have them in the core. I'm almost
confident it will take only a small fraction of time that it took to
implement "round" function.

Maybe floor and ceil are not part of SQL-92 that AFAIK you try to follow --
but these functions are so common that you should still consider it.

P.S. I'm aware of workaround for floor (only for positive numbers --
floor(N) == round(N - 0.5)) but it is only a workaround.
--
Truly yours,
Artem Skoretskiy
Jean Chevalier
2015-07-24 13:23:59 UTC
Permalink
Floor and Ceil can be dynamically loaded. Check last entry here: http://www.sqlite.org/contrib
Post by Artem Skoretskiy
Hi all,
According to the documentation https://www.sqlite.org/lang_corefunc.html
SQLite does not provide some basic math functions such as floor and ceil.
They are pretty handy additions for "round" function that is present.
For me as developer it would be great to have them in the core. I'm almost
confident it will take only a small fraction of time that it took to
implement "round" function.
Maybe floor and ceil are not part of SQL-92 that AFAIK you try to follow --
but these functions are so common that you should still consider it.
P.S. I'm aware of workaround for floor (only for positive numbers --
floor(N) == round(N - 0.5)) but it is only a workaround.
--
Truly yours,
Artem Skoretskiy
Artem Skoretskiy
2015-07-24 14:43:19 UTC
Permalink
What about including (some of them) into the core? So that every user on
every SQLite could use them without extra work?

Also that looks like you could easily shot your leg: "The files below are
contributed by users and are not part of the standard SQLite package. The
content of these files has not been verified. Use at your own risk."
Post by Jean Chevalier
http://www.sqlite.org/contrib
Post by Artem Skoretskiy
Hi all,
According to the documentation https://www.sqlite.org/lang_corefunc.html
SQLite does not provide some basic math functions such as floor and ceil.
They are pretty handy additions for "round" function that is present.
For me as developer it would be great to have them in the core. I'm
almost
Post by Artem Skoretskiy
confident it will take only a small fraction of time that it took to
implement "round" function.
Maybe floor and ceil are not part of SQL-92 that AFAIK you try to follow
--
Post by Artem Skoretskiy
but these functions are so common that you should still consider it.
P.S. I'm aware of workaround for floor (only for positive numbers --
floor(N) == round(N - 0.5)) but it is only a workaround.
--
Truly yours,
Artem Skoretskiy
_______________________________________________
sqlite-users mailing list
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
--
Truly yours,
Artem Skoretskiy
Richard Hipp
2015-07-24 14:49:37 UTC
Permalink
Post by Artem Skoretskiy
What about including (some of them) into the core? So that every user on
every SQLite could use them without extra work?
Because it creates a dependency on -lm
--
D. Richard Hipp
***@sqlite.org
Stephan Beal
2015-07-24 14:56:33 UTC
Permalink
Post by Richard Hipp
Post by Artem Skoretskiy
What about including (some of them) into the core? So that every user on
every SQLite could use them without extra work?
Because it creates a dependency on -lm
FWIW, floor() and ceil() are also C99, not C89.
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
Loading...