Changeset: 17f6dbcbe98a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=17f6dbcbe98a
Modified Files:
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql.h
        sql/backends/monet5/sql_fround.c
        sql/backends/monet5/sql_fround_impl.h
        sql/backends/monet5/sql_round_impl.h
        sql/common/sql_types.c
Branch: clean-candidates
Log Message:

Implemented round with candidate list for floating-points, minor fixes and 
moved the implementation module from 'sql' to 'calc'. Now running tests...


diffs (truncated from 1036 to 300 lines):

diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -5618,79 +5618,99 @@ static mel_func sql_init_funcs[] = {
  pattern("sql", "prepared_statements_args", 
SQLsession_prepared_statements_args, false, "Available prepared statements' 
arguments in the current session", args(9,9, 
batarg("statementid",int),batarg("type",str),batarg("digits",int),batarg("scale",int),batarg("inout",bte),batarg("number",int),batarg("schema",str),batarg("table",str),batarg("column",str))),
  pattern("sql", "copy_rejects", COPYrejects, false, "", args(4,4, 
batarg("rowid",lng),batarg("fldid",int),batarg("msg",str),batarg("inp",str))),
  pattern("sql", "copy_rejects_clear", COPYrejects_clear, true, "", noargs),
- command("sql", "dec_round", bte_dec_round_wrap, false, "round off the value v 
to nearests multiple of r", args(1,3, arg("",bte),arg("v",bte),arg("r",bte))),
- pattern("batsql", "dec_round", bte_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,3, 
batarg("",bte),batarg("v",bte),arg("r",bte))),
- pattern("batsql", "dec_round", bte_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,4, 
batarg("",bte),batarg("v",bte),arg("r",bte),batarg("s",oid))),
- pattern("batsql", "dec_round", bte_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,3, 
batarg("",bte),arg("v",bte),batarg("r",bte))),
- pattern("batsql", "dec_round", bte_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,4, 
batarg("",bte),arg("v",bte),batarg("r",bte),batarg("s",oid))),
- pattern("batsql", "dec_round", bte_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,3, 
batarg("",bte),batarg("v",bte),batarg("r",bte))),
- pattern("batsql", "dec_round", bte_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,5, 
batarg("",bte),batarg("v",bte),batarg("r",bte),batarg("s1",oid),batarg("s2",oid))),
- command("sql", "round", bte_round_wrap, false, "round off the decimal v(d,s) 
to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
arg("",bte),arg("v",bte),arg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", bte_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
batarg("",bte),batarg("v",bte),arg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", bte_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,6, 
batarg("",bte),batarg("v",bte),arg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
- pattern("batsql", "round", bte_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",bte),arg("v",bte),batarg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", bte_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,6, 
batarg("",bte),arg("v",bte),batarg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
- pattern("batsql", "round", bte_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",bte),batarg("v",bte),batarg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", bte_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,7, 
batarg("",bte),batarg("v",bte),batarg("r",bte),batarg("s1",oid),batarg("s2",oid),arg("d",int),arg("s",int))),
+ command("calc", "dec_round", bte_dec_round_wrap, false, "round off the value 
v to nearests multiple of r", args(1,3, arg("",bte),arg("v",bte),arg("r",bte))),
+ pattern("batcalc", "dec_round", bte_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,3, 
batarg("",bte),batarg("v",bte),arg("r",bte))),
+ pattern("batcalc", "dec_round", bte_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,4, 
batarg("",bte),batarg("v",bte),arg("r",bte),batarg("s",oid))),
+ pattern("batcalc", "dec_round", bte_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,3, 
batarg("",bte),arg("v",bte),batarg("r",bte))),
+ pattern("batcalc", "dec_round", bte_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,4, 
batarg("",bte),arg("v",bte),batarg("r",bte),batarg("s",oid))),
+ pattern("batcalc", "dec_round", bte_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,3, 
batarg("",bte),batarg("v",bte),batarg("r",bte))),
+ pattern("batcalc", "dec_round", bte_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,5, 
batarg("",bte),batarg("v",bte),batarg("r",bte),batarg("s1",oid),batarg("s2",oid))),
+ command("calc", "round", bte_round_wrap, false, "round off the decimal v(d,s) 
to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
arg("",bte),arg("v",bte),arg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", bte_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
batarg("",bte),batarg("v",bte),arg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", bte_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,6, 
batarg("",bte),batarg("v",bte),arg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", bte_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",bte),arg("v",bte),batarg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", bte_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,6, 
batarg("",bte),arg("v",bte),batarg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", bte_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",bte),batarg("v",bte),batarg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", bte_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,7, 
batarg("",bte),batarg("v",bte),batarg("r",bte),batarg("s1",oid),batarg("s2",oid),arg("d",int),arg("s",int))),
  command("calc", "second_interval", bte_dec2second_interval, false, "cast bte 
decimal to a second_interval", args(1,5, 
arg("",lng),arg("sc",int),arg("v",bte),arg("ek",int),arg("sk",int))),
  pattern("batcalc", "second_interval", bte_batdec2second_interval, false, 
"cast bte decimal to a second_interval", args(1,6, 
batarg("",lng),arg("sc",int),batarg("v",bte),batarg("s",oid),arg("ek",int),arg("sk",int))),
- command("sql", "dec_round", sht_dec_round_wrap, false, "round off the value v 
to nearests multiple of r", args(1,3, arg("",sht),arg("v",sht),arg("r",sht))),
- pattern("batsql", "dec_round", sht_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,3, 
batarg("",sht),batarg("v",sht),arg("r",sht))),
- pattern("batsql", "dec_round", sht_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,4, 
batarg("",sht),batarg("v",sht),arg("r",sht),batarg("s",oid))),
- pattern("batsql", "dec_round", sht_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,3, 
batarg("",sht),arg("v",sht),batarg("r",sht))),
- pattern("batsql", "dec_round", sht_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,4, 
batarg("",sht),arg("v",sht),batarg("r",sht),batarg("s",oid))),
- pattern("batsql", "dec_round", sht_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,3, 
batarg("",sht),batarg("v",sht),batarg("r",sht))),
- pattern("batsql", "dec_round", sht_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,5, 
batarg("",sht),batarg("v",sht),batarg("r",sht),batarg("s1",oid),batarg("s2",oid))),
- command("sql", "round", sht_round_wrap, false, "round off the decimal v(d,s) 
to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
arg("",sht),arg("v",sht),arg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", sht_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
batarg("",sht),batarg("v",sht),arg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", sht_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,6, 
batarg("",sht),batarg("v",sht),arg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
- pattern("batsql", "round", sht_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",sht),arg("v",sht),batarg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", sht_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,6, 
batarg("",sht),arg("v",sht),batarg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
- pattern("batsql", "round", sht_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",sht),batarg("v",sht),batarg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", sht_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,7, 
batarg("",sht),batarg("v",sht),batarg("r",bte),batarg("s1",oid),batarg("s2",oid),arg("d",int),arg("s",int))),
+ command("calc", "dec_round", sht_dec_round_wrap, false, "round off the value 
v to nearests multiple of r", args(1,3, arg("",sht),arg("v",sht),arg("r",sht))),
+ pattern("batcalc", "dec_round", sht_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,3, 
batarg("",sht),batarg("v",sht),arg("r",sht))),
+ pattern("batcalc", "dec_round", sht_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,4, 
batarg("",sht),batarg("v",sht),arg("r",sht),batarg("s",oid))),
+ pattern("batcalc", "dec_round", sht_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,3, 
batarg("",sht),arg("v",sht),batarg("r",sht))),
+ pattern("batcalc", "dec_round", sht_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,4, 
batarg("",sht),arg("v",sht),batarg("r",sht),batarg("s",oid))),
+ pattern("batcalc", "dec_round", sht_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,3, 
batarg("",sht),batarg("v",sht),batarg("r",sht))),
+ pattern("batcalc", "dec_round", sht_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,5, 
batarg("",sht),batarg("v",sht),batarg("r",sht),batarg("s1",oid),batarg("s2",oid))),
+ command("calc", "round", sht_round_wrap, false, "round off the decimal v(d,s) 
to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
arg("",sht),arg("v",sht),arg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", sht_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
batarg("",sht),batarg("v",sht),arg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", sht_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,6, 
batarg("",sht),batarg("v",sht),arg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", sht_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",sht),arg("v",sht),batarg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", sht_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,6, 
batarg("",sht),arg("v",sht),batarg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", sht_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",sht),batarg("v",sht),batarg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", sht_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,7, 
batarg("",sht),batarg("v",sht),batarg("r",bte),batarg("s1",oid),batarg("s2",oid),arg("d",int),arg("s",int))),
  command("calc", "second_interval", sht_dec2second_interval, false, "cast sht 
decimal to a second_interval", args(1,5, 
arg("",lng),arg("sc",int),arg("v",sht),arg("ek",int),arg("sk",int))),
  pattern("batcalc", "second_interval", sht_batdec2second_interval, false, 
"cast sht decimal to a second_interval", args(1,6, 
batarg("",lng),arg("sc",int),batarg("v",sht),batarg("s",oid),arg("ek",int),arg("sk",int))),
- command("sql", "dec_round", int_dec_round_wrap, false, "round off the value v 
to nearests multiple of r", args(1,3, arg("",int),arg("v",int),arg("r",int))),
- pattern("batsql", "dec_round", int_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,3, 
batarg("",int),batarg("v",int),arg("r",int))),
- pattern("batsql", "dec_round", int_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,4, 
batarg("",int),batarg("v",int),arg("r",int),batarg("s",oid))),
- pattern("batsql", "dec_round", int_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,3, 
batarg("",int),arg("v",int),batarg("r",int))),
- pattern("batsql", "dec_round", int_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,4, 
batarg("",int),arg("v",int),batarg("r",int),batarg("s",oid))),
- pattern("batsql", "dec_round", int_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,3, 
batarg("",int),batarg("v",int),batarg("r",int))),
- pattern("batsql", "dec_round", int_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,5, 
batarg("",int),batarg("v",int),batarg("r",int),batarg("s1",oid),batarg("s2",oid))),
- command("sql", "round", int_round_wrap, false, "round off the decimal v(d,s) 
to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
arg("",int),arg("v",int),arg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", int_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
batarg("",int),batarg("v",int),arg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", int_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,6, 
batarg("",int),batarg("v",int),arg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
- pattern("batsql", "round", int_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",int),arg("v",int),batarg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", int_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,6, 
batarg("",int),arg("v",int),batarg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
- pattern("batsql", "round", int_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",int),batarg("v",int),batarg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", int_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,7, 
batarg("",int),batarg("v",int),batarg("r",bte),batarg("s1",oid),batarg("s2",oid),arg("d",int),arg("s",int))),
+ command("calc", "dec_round", int_dec_round_wrap, false, "round off the value 
v to nearests multiple of r", args(1,3, arg("",int),arg("v",int),arg("r",int))),
+ pattern("batcalc", "dec_round", int_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,3, 
batarg("",int),batarg("v",int),arg("r",int))),
+ pattern("batcalc", "dec_round", int_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,4, 
batarg("",int),batarg("v",int),arg("r",int),batarg("s",oid))),
+ pattern("batcalc", "dec_round", int_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,3, 
batarg("",int),arg("v",int),batarg("r",int))),
+ pattern("batcalc", "dec_round", int_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,4, 
batarg("",int),arg("v",int),batarg("r",int),batarg("s",oid))),
+ pattern("batcalc", "dec_round", int_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,3, 
batarg("",int),batarg("v",int),batarg("r",int))),
+ pattern("batcalc", "dec_round", int_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,5, 
batarg("",int),batarg("v",int),batarg("r",int),batarg("s1",oid),batarg("s2",oid))),
+ command("calc", "round", int_round_wrap, false, "round off the decimal v(d,s) 
to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
arg("",int),arg("v",int),arg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", int_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
batarg("",int),batarg("v",int),arg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", int_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,6, 
batarg("",int),batarg("v",int),arg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", int_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",int),arg("v",int),batarg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", int_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,6, 
batarg("",int),arg("v",int),batarg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", int_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",int),batarg("v",int),batarg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", int_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,7, 
batarg("",int),batarg("v",int),batarg("r",bte),batarg("s1",oid),batarg("s2",oid),arg("d",int),arg("s",int))),
  command("calc", "second_interval", int_dec2second_interval, false, "cast int 
decimal to a second_interval", args(1,5, 
arg("",lng),arg("sc",int),arg("v",int),arg("ek",int),arg("sk",int))),
  pattern("batcalc", "second_interval", int_batdec2second_interval, false, 
"cast int decimal to a second_interval", args(1,6, 
batarg("",lng),arg("sc",int),batarg("v",int),batarg("s",oid),arg("ek",int),arg("sk",int))),
- command("sql", "dec_round", lng_dec_round_wrap, false, "round off the value v 
to nearests multiple of r", args(1,3, arg("",lng),arg("v",lng),arg("r",lng))),
- pattern("batsql", "dec_round", lng_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,3, 
batarg("",lng),batarg("v",lng),arg("r",lng))),
- pattern("batsql", "dec_round", lng_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,4, 
batarg("",lng),batarg("v",lng),arg("r",lng),batarg("s",oid))),
- pattern("batsql", "dec_round", lng_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,3, 
batarg("",lng),arg("v",lng),batarg("r",lng))),
- pattern("batsql", "dec_round", lng_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,4, 
batarg("",lng),arg("v",lng),batarg("r",lng),batarg("s",oid))),
- pattern("batsql", "dec_round", lng_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,3, 
batarg("",lng),batarg("v",lng),batarg("r",lng))),
- pattern("batsql", "dec_round", lng_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,5, 
batarg("",lng),batarg("v",lng),batarg("r",lng),batarg("s1",oid),batarg("s2",oid))),
- command("sql", "round", lng_round_wrap, false, "round off the decimal v(d,s) 
to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
arg("",lng),arg("v",lng),arg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", lng_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
batarg("",lng),batarg("v",lng),arg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", lng_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,6, 
batarg("",lng),batarg("v",lng),arg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
- pattern("batsql", "round", lng_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",lng),arg("v",lng),batarg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", lng_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,6, 
batarg("",lng),arg("v",lng),batarg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
- pattern("batsql", "round", lng_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",lng),batarg("v",lng),batarg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", lng_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,7, 
batarg("",lng),batarg("v",lng),batarg("r",bte),batarg("s1",oid),batarg("s2",oid),arg("d",int),arg("s",int))),
+ command("calc", "dec_round", lng_dec_round_wrap, false, "round off the value 
v to nearests multiple of r", args(1,3, arg("",lng),arg("v",lng),arg("r",lng))),
+ pattern("batcalc", "dec_round", lng_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,3, 
batarg("",lng),batarg("v",lng),arg("r",lng))),
+ pattern("batcalc", "dec_round", lng_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,4, 
batarg("",lng),batarg("v",lng),arg("r",lng),batarg("s",oid))),
+ pattern("batcalc", "dec_round", lng_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,3, 
batarg("",lng),arg("v",lng),batarg("r",lng))),
+ pattern("batcalc", "dec_round", lng_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,4, 
batarg("",lng),arg("v",lng),batarg("r",lng),batarg("s",oid))),
+ pattern("batcalc", "dec_round", lng_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,3, 
batarg("",lng),batarg("v",lng),batarg("r",lng))),
+ pattern("batcalc", "dec_round", lng_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,5, 
batarg("",lng),batarg("v",lng),batarg("r",lng),batarg("s1",oid),batarg("s2",oid))),
+ command("calc", "round", lng_round_wrap, false, "round off the decimal v(d,s) 
to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
arg("",lng),arg("v",lng),arg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", lng_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
batarg("",lng),batarg("v",lng),arg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", lng_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,6, 
batarg("",lng),batarg("v",lng),arg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", lng_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",lng),arg("v",lng),batarg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", lng_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,6, 
batarg("",lng),arg("v",lng),batarg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", lng_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",lng),batarg("v",lng),batarg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", lng_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,7, 
batarg("",lng),batarg("v",lng),batarg("r",bte),batarg("s1",oid),batarg("s2",oid),arg("d",int),arg("s",int))),
  command("calc", "second_interval", lng_dec2second_interval, false, "cast lng 
decimal to a second_interval", args(1,5, 
arg("",lng),arg("sc",int),arg("v",lng),arg("ek",int),arg("sk",int))),
  pattern("batcalc", "second_interval", lng_batdec2second_interval, false, 
"cast lng decimal to a second_interval", args(1,6, 
batarg("",lng),arg("sc",int),batarg("v",lng),batarg("s",oid),arg("ek",int),arg("sk",int))),
- command("sql", "dec_round", flt_dec_round_wrap, false, "round off the value v 
to nearests multiple of r", args(1,3, arg("",flt),arg("v",flt),arg("r",flt))),
- command("batsql", "dec_round", flt_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,3, 
batarg("",flt),batarg("v",flt),arg("r",flt))),
- command("sql", "round", flt_round_wrap, false, "round off the floating point 
v to r digits behind the dot (if r < 0, before the dot)", args(1,3, 
arg("",flt),arg("v",flt),arg("r",bte))),
- command("batsql", "round", flt_bat_round_wrap, false, "round off the floating 
point v to r digits behind the dot (if r < 0, before the dot)", args(1,3, 
batarg("",flt),batarg("v",flt),arg("r",bte))),
+ command("calc", "dec_round", flt_dec_round_wrap, false, "round off the value 
v to nearests multiple of r", args(1,3, arg("",flt),arg("v",flt),arg("r",flt))),
+ pattern("batcalc", "dec_round", flt_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,3, 
batarg("",flt),batarg("v",flt),arg("r",flt))),
+ pattern("batcalc", "dec_round", flt_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,4, 
batarg("",flt),batarg("v",flt),arg("r",flt),batarg("s",oid))),
+ pattern("batcalc", "dec_round", flt_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,3, 
batarg("",flt),arg("v",flt),batarg("r",flt))),
+ pattern("batcalc", "dec_round", flt_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,4, 
batarg("",flt),arg("v",flt),batarg("r",flt),batarg("s",oid))),
+ pattern("batcalc", "dec_round", flt_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,3, 
batarg("",flt),batarg("v",flt),batarg("r",flt))),
+ pattern("batcalc", "dec_round", flt_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,5, 
batarg("",flt),batarg("v",flt),batarg("r",flt),batarg("s1",oid),batarg("s2",oid))),
+ command("calc", "round", flt_round_wrap, false, "round off the floating point 
v to r digits behind the dot (if r < 0, before the dot)", args(1,3, 
arg("",flt),arg("v",flt),arg("r",bte))),
+ pattern("batcalc", "round", flt_bat_round_wrap, false, "round off the 
floating point v to r digits behind the dot (if r < 0, before the dot)", 
args(1,3, batarg("",flt),batarg("v",flt),arg("r",bte))),
+ pattern("batcalc", "round", flt_bat_round_wrap, false, "round off the 
floating point v to r digits behind the dot (if r < 0, before the dot)", 
args(1,4, batarg("",flt),batarg("v",flt),arg("r",bte),batarg("s",oid))),
+ pattern("batcalc", "round", flt_bat_round_wrap_cst, false, "round off the 
floating point v to r digits behind the dot (if r < 0, before the dot)", 
args(1,3, batarg("",flt),arg("v",flt),batarg("r",bte))),
+ pattern("batcalc", "round", flt_bat_round_wrap_cst, false, "round off the 
floating point v to r digits behind the dot (if r < 0, before the dot)", 
args(1,4, batarg("",flt),arg("v",flt),batarg("r",bte),batarg("s",oid))),
+ pattern("batcalc", "round", flt_bat_round_wrap_nocst, false, "round off the 
floating point v to r digits behind the dot (if r < 0, before the dot)", 
args(1,3, batarg("",flt),batarg("v",flt),batarg("r",bte))),
+ pattern("batcalc", "round", flt_bat_round_wrap_nocst, false, "round off the 
floating point v to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",flt),batarg("v",flt),batarg("r",bte),batarg("s1",oid),batarg("s2",oid))),
  command("sql", "ms_trunc", flt_trunc_wrap, false, "truncate the floating 
point v to r digits behind the dot (if r < 0, before the dot)", args(1,3, 
arg("",flt),arg("v",flt),arg("r",int))),
- command("sql", "dec_round", dbl_dec_round_wrap, false, "round off the value v 
to nearests multiple of r", args(1,3, arg("",dbl),arg("v",dbl),arg("r",dbl))),
- command("batsql", "dec_round", dbl_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,3, 
batarg("",dbl),batarg("v",dbl),arg("r",dbl))),
- command("sql", "round", dbl_round_wrap, false, "round off the floating point 
v to r digits behind the dot (if r < 0, before the dot)", args(1,3, 
arg("",dbl),arg("v",dbl),arg("r",bte))),
- command("batsql", "round", dbl_bat_round_wrap, false, "round off the floating 
point v to r digits behind the dot (if r < 0, before the dot)", args(1,3, 
batarg("",dbl),batarg("v",dbl),arg("r",bte))),
+ command("calc", "dec_round", dbl_dec_round_wrap, false, "round off the value 
v to nearests multiple of r", args(1,3, arg("",dbl),arg("v",dbl),arg("r",dbl))),
+ pattern("batcalc", "dec_round", dbl_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,3, 
batarg("",dbl),batarg("v",dbl),arg("r",dbl))),
+ pattern("batcalc", "dec_round", dbl_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,4, 
batarg("",dbl),batarg("v",dbl),arg("r",dbl),batarg("s",oid))),
+ pattern("batcalc", "dec_round", dbl_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,3, 
batarg("",dbl),arg("v",dbl),batarg("r",dbl))),
+ pattern("batcalc", "dec_round", dbl_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,4, 
batarg("",dbl),arg("v",dbl),batarg("r",dbl),batarg("s",oid))),
+ pattern("batcalc", "dec_round", dbl_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,3, 
batarg("",dbl),batarg("v",dbl),batarg("r",dbl))),
+ pattern("batcalc", "dec_round", dbl_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,5, 
batarg("",dbl),batarg("v",dbl),batarg("r",dbl),batarg("s1",oid),batarg("s2",oid))),
+ command("calc", "round", dbl_round_wrap, false, "round off the floating point 
v to r digits behind the dot (if r < 0, before the dot)", args(1,3, 
arg("",dbl),arg("v",dbl),arg("r",bte))),
+ pattern("batcalc", "round", dbl_bat_round_wrap, false, "round off the 
floating point v to r digits behind the dot (if r < 0, before the dot)", 
args(1,3, batarg("",dbl),batarg("v",dbl),arg("r",bte))),
+ pattern("batcalc", "round", dbl_bat_round_wrap, false, "round off the 
floating point v to r digits behind the dot (if r < 0, before the dot)", 
args(1,4, batarg("",dbl),batarg("v",dbl),arg("r",bte),batarg("s",oid))),
+ pattern("batcalc", "round", dbl_bat_round_wrap_cst, false, "round off the 
floating point v to r digits behind the dot (if r < 0, before the dot)", 
args(1,3, batarg("",dbl),arg("v",dbl),batarg("r",bte))),
+ pattern("batcalc", "round", dbl_bat_round_wrap_cst, false, "round off the 
floating point v to r digits behind the dot (if r < 0, before the dot)", 
args(1,4, batarg("",dbl),arg("v",dbl),batarg("r",bte),batarg("s",oid))),
+ pattern("batcalc", "round", dbl_bat_round_wrap_nocst, false, "round off the 
floating point v to r digits behind the dot (if r < 0, before the dot)", 
args(1,3, batarg("",dbl),batarg("v",dbl),batarg("r",bte))),
+ pattern("batcalc", "round", dbl_bat_round_wrap_nocst, false, "round off the 
floating point v to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",dbl),batarg("v",dbl),batarg("r",bte),batarg("s1",oid),batarg("s2",oid))),
  command("sql", "ms_trunc", dbl_trunc_wrap, false, "truncate the floating 
point v to r digits behind the dot (if r < 0, before the dot)", args(1,3, 
arg("",dbl),arg("v",dbl),arg("r",int))),
  command("sql", "alpha", SQLcst_alpha_cst, false, "Implementation of astronomy 
alpha function: expands the radius theta depending on the declination", 
args(1,3, arg("",dbl),arg("dec",dbl),arg("theta",dbl))),
  command("batsql", "alpha", SQLbat_alpha_cst, false, "BAT implementation of 
astronomy alpha function", args(1,3, 
batarg("",dbl),batarg("dec",dbl),arg("theta",dbl))),
@@ -6408,20 +6428,20 @@ static mel_func sql_init_funcs[] = {
  pattern("sql", "setmemorylimit", SQLsetmemorylimit, true, "Limit the memory 
claim in MB per query", args(1,3, arg("",void),arg("sid",sht),arg("n",int))),
 #ifdef HAVE_HGE
  /* sql_hge */
- command("sql", "dec_round", hge_dec_round_wrap, false, "round off the value v 
to nearests multiple of r", args(1,3, arg("",hge),arg("v",hge),arg("r",hge))),
- pattern("batsql", "dec_round", hge_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,3, 
batarg("",hge),batarg("v",hge),arg("r",hge))),
- pattern("batsql", "dec_round", hge_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,4, 
batarg("",hge),batarg("v",hge),arg("r",hge),batarg("s",oid))),
- pattern("batsql", "dec_round", hge_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,3, 
batarg("",hge),arg("v",hge),batarg("r",hge))),
- pattern("batsql", "dec_round", hge_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,4, 
batarg("",hge),arg("v",hge),batarg("r",hge),batarg("s",oid))),
- pattern("batsql", "dec_round", hge_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,3, 
batarg("",hge),batarg("v",hge),batarg("r",hge))),
- pattern("batsql", "dec_round", hge_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,5, 
batarg("",hge),batarg("v",hge),batarg("r",hge),batarg("s1",oid),batarg("s2",oid))),
- command("sql", "round", hge_round_wrap, false, "round off the decimal v(d,s) 
to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
arg("",hge),arg("v",hge),arg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", hge_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
batarg("",hge),batarg("v",hge),arg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", hge_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,6, 
batarg("",hge),batarg("v",hge),arg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
- pattern("batsql", "round", hge_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",hge),arg("v",hge),batarg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", hge_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,6, 
batarg("",hge),arg("v",hge),batarg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
- pattern("batsql", "round", hge_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",hge),batarg("v",hge),batarg("r",bte),arg("d",int),arg("s",int))),
- pattern("batsql", "round", hge_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,7, 
batarg("",hge),batarg("v",hge),batarg("r",bte),batarg("s1",oid),batarg("s2",oid),arg("d",int),arg("s",int))),
+ command("calc", "dec_round", hge_dec_round_wrap, false, "round off the value 
v to nearests multiple of r", args(1,3, arg("",hge),arg("v",hge),arg("r",hge))),
+ pattern("batcalc", "dec_round", hge_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,3, 
batarg("",hge),batarg("v",hge),arg("r",hge))),
+ pattern("batcalc", "dec_round", hge_bat_dec_round_wrap, false, "round off the 
value v to nearests multiple of r", args(1,4, 
batarg("",hge),batarg("v",hge),arg("r",hge),batarg("s",oid))),
+ pattern("batcalc", "dec_round", hge_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,3, 
batarg("",hge),arg("v",hge),batarg("r",hge))),
+ pattern("batcalc", "dec_round", hge_bat_dec_round_wrap_cst, false, "round off 
the value v to nearests multiple of r", args(1,4, 
batarg("",hge),arg("v",hge),batarg("r",hge),batarg("s",oid))),
+ pattern("batcalc", "dec_round", hge_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,3, 
batarg("",hge),batarg("v",hge),batarg("r",hge))),
+ pattern("batcalc", "dec_round", hge_bat_dec_round_wrap_nocst, false, "round 
off the value v to nearests multiple of r", args(1,5, 
batarg("",hge),batarg("v",hge),batarg("r",hge),batarg("s1",oid),batarg("s2",oid))),
+ command("calc", "round", hge_round_wrap, false, "round off the decimal v(d,s) 
to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
arg("",hge),arg("v",hge),arg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", hge_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,5, 
batarg("",hge),batarg("v",hge),arg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", hge_bat_round_wrap, false, "round off the decimal 
v(d,s) to r digits behind the dot (if r < 0, before the dot)", args(1,6, 
batarg("",hge),batarg("v",hge),arg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", hge_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",hge),arg("v",hge),batarg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", hge_bat_round_wrap_cst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,6, 
batarg("",hge),arg("v",hge),batarg("r",bte),batarg("s",oid),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", hge_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,5, 
batarg("",hge),batarg("v",hge),batarg("r",bte),arg("d",int),arg("s",int))),
+ pattern("batcalc", "round", hge_bat_round_wrap_nocst, false, "round off the 
decimal v(d,s) to r digits behind the dot (if r < 0, before the dot)", 
args(1,7, 
batarg("",hge),batarg("v",hge),batarg("r",bte),batarg("s1",oid),batarg("s2",oid),arg("d",int),arg("s",int))),
  command("calc", "second_interval", hge_dec2second_interval, false, "cast hge 
decimal to a second_interval", args(1,5, 
arg("",lng),arg("sc",int),arg("v",hge),arg("ek",int),arg("sk",int))),
  pattern("batcalc", "second_interval", hge_batdec2second_interval, false, 
"cast hge decimal to a second_interval", args(1,6, 
batarg("",lng),arg("sc",int),batarg("v",hge),batarg("s",oid),arg("ek",int),arg("sk",int))),
  command("calc", "hge", nil_2dec_hge, false, "cast to dec(hge) and check for 
overflow", args(1,4, 
arg("",hge),arg("v",void),arg("digits",int),arg("scale",int))),
diff --git a/sql/backends/monet5/sql.h b/sql/backends/monet5/sql.h
--- a/sql/backends/monet5/sql.h
+++ b/sql/backends/monet5/sql.h
@@ -250,15 +250,23 @@ sql5_export str SQLstr_cast(Client cntxt
 sql5_export str SQLbatstr_cast(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 
 sql5_export str flt_dec_round_wrap(flt *res, const flt *v, const flt *r);
-sql5_export str flt_bat_dec_round_wrap(bat *res, const bat *v, const flt *r);
+sql5_export str flt_bat_dec_round_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr 
stk, InstrPtr pci);
+sql5_export str flt_bat_dec_round_wrap_cst(Client cntxt, MalBlkPtr mb, 
MalStkPtr stk, InstrPtr pci);
+sql5_export str flt_bat_dec_round_wrap_nocst(Client cntxt, MalBlkPtr mb, 
MalStkPtr stk, InstrPtr pci);
 sql5_export str flt_round_wrap(flt *res, const flt *v, const bte *r);
-sql5_export str flt_bat_round_wrap(bat *res, const bat *v, const bte *r);
+sql5_export str flt_bat_round_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
+sql5_export str flt_bat_round_wrap_cst(Client cntxt, MalBlkPtr mb, MalStkPtr 
stk, InstrPtr pci);
+sql5_export str flt_bat_round_wrap_nocst(Client cntxt, MalBlkPtr mb, MalStkPtr 
stk, InstrPtr pci);
 sql5_export str flt_trunc_wrap(flt *res, const flt *v, const int *r);
 
 sql5_export str dbl_dec_round_wrap(dbl *res, const dbl *v, const dbl *r);
-sql5_export str dbl_bat_dec_round_wrap(bat *res, const bat *v, const dbl *r);
+sql5_export str dbl_bat_dec_round_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr 
stk, InstrPtr pci);
+sql5_export str dbl_bat_dec_round_wrap_cst(Client cntxt, MalBlkPtr mb, 
MalStkPtr stk, InstrPtr pci);
+sql5_export str dbl_bat_dec_round_wrap_nocst(Client cntxt, MalBlkPtr mb, 
MalStkPtr stk, InstrPtr pci);
 sql5_export str dbl_round_wrap(dbl *res, const dbl *v, const bte *r);
-sql5_export str dbl_bat_round_wrap(bat *res, const bat *v, const bte *r);
+sql5_export str dbl_bat_round_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
+sql5_export str dbl_bat_round_wrap_cst(Client cntxt, MalBlkPtr mb, MalStkPtr 
stk, InstrPtr pci);
+sql5_export str dbl_bat_round_wrap_nocst(Client cntxt, MalBlkPtr mb, MalStkPtr 
stk, InstrPtr pci);
 sql5_export str dbl_trunc_wrap(dbl *res, const dbl *v, const int *r);
 
 #define radians(x)     ((x) * (3.14159265358979323846 / 180.0))
diff --git a/sql/backends/monet5/sql_fround.c b/sql/backends/monet5/sql_fround.c
--- a/sql/backends/monet5/sql_fround.c
+++ b/sql/backends/monet5/sql_fround.c
@@ -33,6 +33,35 @@
 
 #define STRING(a)              #a
 
+static void
+finalize_ouput_copy_sorted_property(bat *res, BAT *bn, BAT *b, str msg, bool 
nils, BUN q)
+{
+       if (bn && !msg) {
+               BATsetcount(bn, q);
+               bn->tnil = nils;
+               bn->tnonil = !nils;
+               bn->tkey = BATcount(bn) <= 1;
+               bn->tsorted = !b || b->tsorted;
+               bn->trevsorted = !b || b->trevsorted;
+               BBPkeepref(*res = bn->batCacheid);
+       } else if (bn)
+               BBPreclaim(bn);
+}
+
+static void
+unfix_inputs(int nargs, ...)
+{
+       va_list valist;
+
+       va_start(valist, nargs);
+       for (int i = 0; i < nargs; i++) {
+               BAT *b = va_arg(valist, BAT *);
+               if (b)
+                       BBPunfix(b->batCacheid);
+       }
+       va_end(valist);
+}
+
 #define TYPE flt
 #include "sql_fround_impl.h"
 #undef TYPE
diff --git a/sql/backends/monet5/sql_fround_impl.h 
b/sql/backends/monet5/sql_fround_impl.h
--- a/sql/backends/monet5/sql_fround_impl.h
+++ b/sql/backends/monet5/sql_fround_impl.h
@@ -6,119 +6,270 @@
  * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V.
  */
 
-#define dec_round_body_nonil   FUN(TYPE, dec_round_body_nonil)
 #define dec_round_body         FUN(TYPE, dec_round_body)
 #define dec_round_wrap         FUN(TYPE, dec_round_wrap)
 #define bat_dec_round_wrap     FUN(TYPE, bat_dec_round_wrap)
-#define round_body_nonil       FUN(TYPE, round_body_nonil)
+#define bat_dec_round_wrap_cst FUN(TYPE, bat_dec_round_wrap_cst)
+#define bat_dec_round_wrap_nocst       FUN(TYPE, bat_dec_round_wrap_nocst)
 #define round_body             FUN(TYPE, round_body)
 #define round_wrap             FUN(TYPE, round_wrap)
 #define bat_round_wrap         FUN(TYPE, bat_round_wrap)
+#define bat_round_wrap_cst     FUN(TYPE, bat_round_wrap_cst)
+#define bat_round_wrap_nocst   FUN(TYPE, bat_round_wrap_nocst)
 #define trunc_wrap             FUN(TYPE, trunc_wrap)
 
 static inline TYPE
-dec_round_body_nonil(TYPE v, TYPE r)
+dec_round_body(TYPE v, TYPE r)
 {
        assert(!ISNIL(TYPE)(v));
 
        return v / r;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to