molinaro at oats.inaf.it
Wed Jul 6 10:49:05 CEST 2016
reporting Ger's comment on the MOD function
2016-07-05 21:25 GMT+02:00 Ger van Diepen <diepen at astron.nl>:
> Maybe it should be described what the remainder is in case x and/or y is
> E.g.: x%y gives different results in C and Python for negative numbers.
I indeed think it is (R)DBMS implementation dependent, maybe one more
point to check with Dave's Cosmopterix.
A quick search in the SQL standard discussions online seems to point out
that A%B=R is valid with R having the same sign as A and ABS(R) being
smaller than ABS(B), plus the counter check that A=B*K+R where K is some
integer value (out of A/B).
Maybe we are lucky and all the RDBMSs we're interested in act this way.
I'm not sure, however, that forcing this thing into the standard would be
useful. Probably alerting the ADQL users might be enough.
>>>> Marco Molinaro <molinaro at oats.inaf.it> 07/05/16 3:32 PM >>>
> Dear Mark, DAL,
> I think this is an erratum, with x and y switched in the description.
> 2016-07-05 15:25 GMT+02:00 Mark Taylor <M.B.Taylor at bristol.ac.uk>:
>> Dear DAL,
>> table 1 of REC-ADQL-2.0 defines the MOD function thus:
>> Name Arg type Return type Description
>> --------- -------- ----------- -----------
>> mod(x, y) double double Returns the remainder of y/x.
>> but as far as I can see, SQL 2003 (I presume 92 as well) and all
>> the TAP services that I generally use define the arguments the other
>> way around, i.e. returning the remainder of x/y.
>> Am I misreading something or is this an erratum candidate?
>> Mark Taylor Astronomical Programmer Physics, Bristol University, UK
>> m.b.taylor at bris.ac.uk +44-117-9288776 http://www.star.bris.ac.uk/~mbt/
More information about the dal