LCOV - code coverage report
Current view: top level - monetdb5/modules/kernel - batmmath.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 173 290 59.7 %
Date: 2021-10-13 02:24:04 Functions: 21 28 75.0 %

          Line data    Source code
       1             : /*
       2             :  * This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0.  If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       5             :  *
       6             :  * Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V.
       7             :  */
       8             : 
       9             : #include "monetdb_config.h"
      10             : #include <fenv.h>
      11             : #include "mmath_private.h"
      12             : #include "mal_exception.h"
      13             : #include "mal_interpreter.h"
      14             : 
      15             : static str
      16         117 : CMDscienceUNARY(MalStkPtr stk, InstrPtr pci,
      17             :                                 float (*ffunc)(float), double (*dfunc)(double),
      18             :                                 const char *malfunc)
      19             : {
      20             :         bat bid;
      21             :         BAT *bn, *b, *s = NULL;
      22             :         struct canditer ci;
      23             :         oid x, off;
      24             :         BUN i, ncand;
      25             :         BUN nils = 0;
      26             :         int e = 0, ex = 0;
      27             :         BATiter bi;
      28             : 
      29         117 :         bid = *getArgReference_bat(stk, pci, 1);
      30         117 :         if ((b = BATdescriptor(bid)) == NULL)
      31           0 :                 throw(MAL, malfunc, SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
      32             : 
      33         117 :         if (pci->argc == 3) {
      34          13 :                 bid = *getArgReference_bat(stk, pci, 2);
      35          13 :                 if (!is_bat_nil(bid)) {
      36           0 :                         if ((s = BATdescriptor(bid)) == NULL) {
      37           0 :                                 BBPunfix(b->batCacheid);
      38           0 :                                 throw(MAL, malfunc, SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
      39             :                         }
      40             :                 }
      41             :         }
      42             : 
      43         117 :         ncand = canditer_init(&ci, b, s);
      44         117 :         off = ci.hseq;
      45         117 :         bn = COLnew(off, b->ttype, ncand, TRANSIENT);
      46         117 :         if (bn == NULL || ncand == 0) {
      47          22 :                 BBPunfix(b->batCacheid);
      48          22 :                 if (s)
      49           0 :                         BBPunfix(s->batCacheid);
      50          22 :                 if (bn == NULL)
      51           0 :                         throw(MAL, malfunc, GDK_EXCEPTION);
      52          22 :                 goto doreturn;
      53             :         }
      54             : 
      55          95 :         errno = 0;
      56          95 :         feclearexcept(FE_ALL_EXCEPT);
      57          95 :         bi = bat_iterator(b);
      58          95 :         switch (b->ttype) {
      59          17 :         case TYPE_flt: {
      60          17 :                 const flt *restrict fsrc = (const flt *) bi.base;
      61          17 :                 flt *restrict fdst = (flt *) Tloc(bn, 0);
      62          73 :                 for (i = 0; i < ncand; i++) {
      63          56 :                         x = canditer_next(&ci) - off;
      64          56 :                         if (is_flt_nil(fsrc[x])) {
      65           2 :                                 fdst[i] = flt_nil;
      66           2 :                                 nils++;
      67             :                         } else {
      68          54 :                                 fdst[i] = ffunc(fsrc[x]);
      69             :                         }
      70             :                 }
      71             :                 break;
      72             :         }
      73          78 :         case TYPE_dbl: {
      74          78 :                 const dbl *restrict dsrc = (const dbl *) bi.base;
      75          78 :                 dbl *restrict ddst = (dbl *) Tloc(bn, 0);
      76        2126 :                 for (i = 0; i < ncand; i++) {
      77        2048 :                         x = canditer_next(&ci) - off;
      78        2048 :                         if (is_dbl_nil(dsrc[x])) {
      79         440 :                                 ddst[i] = dbl_nil;
      80         440 :                                 nils++;
      81             :                         } else {
      82        1608 :                                 ddst[i] = dfunc(dsrc[x]);
      83             :                         }
      84             :                 }
      85             :                 break;
      86             :         }
      87             :         default:
      88           0 :                 assert(0);
      89             :         }
      90          95 :         bat_iterator_end(&bi);
      91          95 :         e = errno;
      92          95 :         ex = fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW);
      93          95 :         BBPunfix(b->batCacheid);
      94          95 :         if (s)
      95           0 :                 BBPunfix(s->batCacheid);
      96          95 :         if (e != 0 || ex != 0) {
      97             :                 const char *err;
      98           0 :                 BBPunfix(bn->batCacheid);
      99           0 :                 if (e)
     100           0 :                         err = GDKstrerror(e, (char[128]){0}, 128);
     101           0 :                 else if (ex & FE_DIVBYZERO)
     102             :                         err = "Divide by zero";
     103           0 :                 else if (ex & FE_OVERFLOW)
     104             :                         err = "Overflow";
     105             :                 else
     106             :                         err = "Invalid result";
     107           0 :                 throw(MAL, malfunc, "Math exception: %s", err);
     108             :         }
     109             : 
     110          95 :         BATsetcount(bn, ncand);
     111          95 :         bn->tsorted = false;
     112          95 :         bn->trevsorted = false;
     113          95 :         bn->tnil = nils != 0;
     114          95 :         bn->tnonil = nils == 0;
     115          95 :         BATkey(bn, false);
     116         117 :   doreturn:
     117         117 :         *getArgReference_bat(stk, pci, 0) = bn->batCacheid;
     118         117 :         BBPkeepref(bn->batCacheid);
     119         117 :         return MAL_SUCCEED;
     120             : }
     121             : 
     122             : static str
     123           6 : CMDscienceBINARY(MalStkPtr stk, InstrPtr pci,
     124             :                                  float (*ffunc)(float, float), double (*dfunc)(double, double),
     125             :                                  const char *malfunc)
     126             : {
     127             :         bat bid;
     128             :         BAT *bn, *b1 = NULL, *b2 = NULL, *s1 = NULL, *s2 = NULL;
     129             :         int tp1, tp2;
     130           6 :         struct canditer ci1 = (struct canditer){0}, ci2 = (struct canditer){0};
     131             :         oid x1, x2, off1, off2;
     132             :         BUN i, ncand, nils = 0;
     133             :         int e = 0, ex = 0;
     134             :         BATiter b1i, b2i;
     135             : 
     136           6 :         tp1 = stk->stk[getArg(pci, 1)].vtype;
     137           6 :         tp2 = stk->stk[getArg(pci, 2)].vtype;
     138             : 
     139           6 :         if (tp1 == TYPE_bat) {
     140           4 :                 bid = *getArgReference_bat(stk, pci, 1);
     141           4 :                 b1 = BATdescriptor(bid);
     142           4 :                 if (b1 == NULL)
     143           0 :                         goto bailout;
     144           4 :                 tp1 = b1->ttype;
     145             :         }
     146             : 
     147           6 :         if (tp2 == TYPE_bat) {
     148           3 :                 bid = *getArgReference_bat(stk, pci, 2);
     149           3 :                 b2 = BATdescriptor(bid);
     150           3 :                 if (b2 == NULL)
     151           0 :                         goto bailout;
     152           3 :                 tp2 = b2->ttype;
     153             :         }
     154           6 :         tp1 = ATOMbasetype(tp1);
     155           6 :         tp2 = ATOMbasetype(tp2);
     156           6 :         assert(tp1 == tp2);
     157           6 :         assert(b1 != NULL || b2 != NULL);
     158             : 
     159           6 :         if (pci->argc > 4) {
     160           1 :                 assert(pci->argc == 5);
     161           1 :                 bid = *getArgReference_bat(stk, pci, 4);
     162           1 :                 if (!is_bat_nil(bid)) {
     163           0 :                         s2 = BATdescriptor(bid);
     164           0 :                         if (s2 == NULL)
     165           0 :                                 goto bailout;
     166             :                 }
     167             :         }
     168           6 :         if (pci->argc > 3) {
     169           1 :                 bid = *getArgReference_bat(stk, pci, 3);
     170           1 :                 if (!is_bat_nil(bid)) {
     171           0 :                         s1 = BATdescriptor(bid);
     172           0 :                         if (s1 == NULL)
     173           0 :                                 goto bailout;
     174           0 :                         if (b1 == NULL) {
     175             :                                 s2 = s1;
     176             :                                 s1 = NULL;
     177             :                         }
     178             :                 }
     179             :         }
     180             : 
     181           6 :         if (b1)
     182           4 :                 canditer_init(&ci1, b1, s1);
     183           6 :         if (b2)
     184           3 :                 canditer_init(&ci2, b2, s2);
     185           6 :         ncand = b1 ? ci1.ncand : ci2.ncand;
     186           6 :         off1 = ci1.hseq;
     187           6 :         off2 = ci2.hseq;
     188             : 
     189           8 :         if (b1 == NULL &&
     190             :                 (tp1 == TYPE_flt ?
     191           0 :                  is_flt_nil(stk->stk[getArg(pci, 1)].val.fval) :
     192           2 :                  is_dbl_nil(stk->stk[getArg(pci, 1)].val.dval))) {
     193           0 :                 bn = BATconstant(off2, tp1, ATOMnilptr(tp1), ncand, TRANSIENT);
     194           0 :                 goto doreturn;
     195             :         }
     196           9 :         if (b2 == NULL &&
     197             :                 (tp1 == TYPE_flt ?
     198           0 :                  is_flt_nil(stk->stk[getArg(pci, 2)].val.fval) :
     199           3 :                  is_dbl_nil(stk->stk[getArg(pci, 2)].val.dval))) {
     200           0 :                 bn = BATconstant(off1, tp1, ATOMnilptr(tp1), ncand, TRANSIENT);
     201           0 :                 goto doreturn;
     202             :         }
     203           6 :         if (b1)
     204           4 :                 bn = COLnew(off1, tp1, ncand, TRANSIENT);
     205             :         else
     206           2 :                 bn = COLnew(off2, tp1, ncand, TRANSIENT);
     207           6 :         if (bn == NULL || ncand == 0)
     208           5 :                 goto doreturn;
     209             : 
     210           1 :         b1i = bat_iterator(b1);
     211           1 :         b2i = bat_iterator(b2);
     212           1 :         errno = 0;
     213           1 :         feclearexcept(FE_ALL_EXCEPT);
     214           1 :         switch (tp1) {
     215           0 :         case TYPE_flt:
     216           0 :                 if (b1 && b2) {
     217           0 :                         const flt *fsrc1 = (const flt *) b1i.base;
     218           0 :                         const flt *fsrc2 = (const flt *) b2i.base;
     219           0 :                         flt *restrict fdst = (flt *) Tloc(bn, 0);
     220           0 :                         for (i = 0; i < ncand; i++) {
     221           0 :                                 x1 = canditer_next(&ci1) - off1;
     222           0 :                                 x2 = canditer_next(&ci2) - off2;
     223           0 :                                 if (is_flt_nil(fsrc1[x1]) ||
     224           0 :                                         is_flt_nil(fsrc2[x2])) {
     225           0 :                                         fdst[i] = flt_nil;
     226           0 :                                         nils++;
     227             :                                 } else {
     228           0 :                                         fdst[i] = ffunc(fsrc1[x1], fsrc2[x2]);
     229             :                                 }
     230             :                         }
     231           0 :                 } else if (b1) {
     232           0 :                         const flt *restrict fsrc1 = (const flt *) b1i.base;
     233           0 :                         flt fval2 = stk->stk[getArg(pci, 2)].val.fval;
     234           0 :                         flt *restrict fdst = (flt *) Tloc(bn, 0);
     235           0 :                         for (i = 0; i < ncand; i++) {
     236           0 :                                 x1 = canditer_next(&ci1) - off1;
     237           0 :                                 if (is_flt_nil(fsrc1[x1])) {
     238           0 :                                         fdst[i] = flt_nil;
     239           0 :                                         nils++;
     240             :                                 } else {
     241           0 :                                         fdst[i] = ffunc(fsrc1[x1], fval2);
     242             :                                 }
     243             :                         }
     244             :                 } else /* b2 == NULL */ {
     245           0 :                         flt fval1 = stk->stk[getArg(pci, 1)].val.fval;
     246           0 :                         const flt *restrict fsrc2 = (const flt *) b2i.base;
     247           0 :                         flt *restrict fdst = (flt *) Tloc(bn, 0);
     248           0 :                         for (i = 0; i < ncand; i++) {
     249           0 :                                 x2 = canditer_next(&ci2) - off2;
     250           0 :                                 if (is_flt_nil(fsrc2[x2])) {
     251           0 :                                         fdst[i] = flt_nil;
     252           0 :                                         nils++;
     253             :                                 } else {
     254           0 :                                         fdst[i] = ffunc(fval1, fsrc2[x2]);
     255             :                                 }
     256             :                         }
     257             :                 }
     258             :                 break;
     259           1 :         case TYPE_dbl:
     260           1 :                 if (b1 && b2) {
     261           0 :                         const dbl *dsrc1 = (const dbl *) b1i.base;
     262           0 :                         const dbl *dsrc2 = (const dbl *) b2i.base;
     263           0 :                         dbl *restrict ddst = (dbl *) Tloc(bn, 0);
     264           0 :                         for (i = 0; i < ncand; i++) {
     265           0 :                                 x1 = canditer_next(&ci1) - off1;
     266           0 :                                 x2 = canditer_next(&ci2) - off2;
     267           0 :                                 if (is_dbl_nil(dsrc1[x1]) ||
     268           0 :                                         is_dbl_nil(dsrc2[x2])) {
     269           0 :                                         ddst[i] = dbl_nil;
     270           0 :                                         nils++;
     271             :                                 } else {
     272           0 :                                         ddst[i] = dfunc(dsrc1[x1], dsrc2[x2]);
     273             :                                 }
     274             :                         }
     275           1 :                 } else if (b1) {
     276           0 :                         const dbl *restrict dsrc1 = (const dbl *) b1i.base;
     277           0 :                         dbl dval2 = stk->stk[getArg(pci, 2)].val.dval;
     278           0 :                         dbl *restrict ddst = (dbl *) Tloc(bn, 0);
     279           0 :                         for (i = 0; i < ncand; i++) {
     280           0 :                                 x1 = canditer_next(&ci1) - off1;
     281           0 :                                 if (is_dbl_nil(dsrc1[x1])) {
     282           0 :                                         ddst[i] = dbl_nil;
     283           0 :                                         nils++;
     284             :                                 } else {
     285           0 :                                         ddst[i] = dfunc(dsrc1[x1], dval2);
     286             :                                 }
     287             :                         }
     288             :                 } else /* b2 == NULL */ {
     289           1 :                         dbl dval1 = stk->stk[getArg(pci, 1)].val.dval;
     290           1 :                         const dbl *restrict dsrc2 = (const dbl *) b2i.base;
     291           1 :                         dbl *restrict ddst = (dbl *) Tloc(bn, 0);
     292           9 :                         for (i = 0; i < ncand; i++) {
     293           8 :                                 x2 = canditer_next(&ci2) - off2;
     294           8 :                                 if (is_dbl_nil(dsrc2[x2])) {
     295           0 :                                         ddst[i] = dbl_nil;
     296           0 :                                         nils++;
     297             :                                 } else {
     298           8 :                                         ddst[i] = dfunc(dval1, dsrc2[x2]);
     299             :                                 }
     300             :                         }
     301             :                 }
     302             :                 break;
     303             :         default:
     304           0 :                 assert(0);
     305             :         }
     306           1 :         e = errno;
     307           1 :         ex = fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW);
     308           1 :         bat_iterator_end(&b1i);
     309           1 :         bat_iterator_end(&b2i);
     310             : 
     311           1 :         BATsetcount(bn, ncand);
     312           1 :         bn->tsorted = false;
     313           1 :         bn->trevsorted = false;
     314           1 :         bn->tnil = nils != 0;
     315           1 :         bn->tnonil = nils == 0;
     316           1 :         BATkey(bn, false);
     317             : 
     318           6 :   doreturn:
     319           6 :         if (b1)
     320           4 :                 BBPunfix(b1->batCacheid);
     321           6 :         if (b2)
     322           3 :                 BBPunfix(b2->batCacheid);
     323           6 :         if (s1)
     324           0 :                 BBPunfix(s1->batCacheid);
     325           6 :         if (s2)
     326           0 :                 BBPunfix(s2->batCacheid);
     327           6 :         if (bn == NULL)
     328           0 :                 throw(MAL, malfunc, GDK_EXCEPTION);
     329           6 :         if (e != 0 || ex != 0) {
     330             :                 const char *err;
     331           0 :                 BBPunfix(bn->batCacheid);
     332           0 :                 if (e)
     333           0 :                         err = GDKstrerror(e, (char[128]){0}, 128);
     334           0 :                 else if (ex & FE_DIVBYZERO)
     335             :                         err = "Divide by zero";
     336           0 :                 else if (ex & FE_OVERFLOW)
     337             :                         err = "Overflow";
     338             :                 else
     339             :                         err = "Invalid result";
     340           0 :                 throw(MAL, malfunc, "Math exception: %s", err);
     341             :         }
     342           6 :         *getArgReference_bat(stk, pci, 0) = bn->batCacheid;
     343           6 :         BBPkeepref(bn->batCacheid);
     344           6 :         return MAL_SUCCEED;
     345             : 
     346           0 :   bailout:
     347           0 :         if (b1)
     348           0 :                 BBPunfix(b1->batCacheid);
     349           0 :         if (b2)
     350           0 :                 BBPunfix(b2->batCacheid);
     351             : /* cannot happen
     352             :         if (s1)
     353             :                 BBPunfix(s1->batCacheid);
     354             : */
     355           0 :         if (s2)
     356           0 :                 BBPunfix(s2->batCacheid);
     357           0 :         throw(MAL, malfunc, SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
     358             : }
     359             : 
     360             : #define scienceImpl(FUNC)                                                                                               \
     361             : static str                                                                                                                              \
     362             : CMDscience_bat_##FUNC(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) \
     363             : {                                                                                                                                               \
     364             :         (void) cntxt;                                                                                                           \
     365             :         (void) mb;                                                                                                                      \
     366             :                                                                                                                                                 \
     367             :         return CMDscienceUNARY(stk, pci, FUNC##f, FUNC, "batmmath." #FUNC);   \
     368             : }
     369             : 
     370             : #define scienceBinaryImpl(FUNC)                                                                                 \
     371             : static str                                                                                                                              \
     372             : CMDscience_bat_##FUNC(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) \
     373             : {                                                                                                                                               \
     374             :         (void) cntxt;                                                                                                           \
     375             :         (void) mb;                                                                                                                      \
     376             :                                                                                                                                                 \
     377             :         return CMDscienceBINARY(stk, pci, FUNC##f, FUNC, "batmmath." #FUNC); \
     378             : }
     379             : 
     380             : static str
     381          13 : CMDscience_bat_randintarg(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
     382             : {
     383             :         BAT *bn = NULL, *b = NULL, *bs = NULL;
     384             :         BUN q = 0;
     385             :         int *restrict vals;
     386             :         str msg = MAL_SUCCEED;
     387          13 :         struct canditer ci = {0};
     388          13 :         bat *res = getArgReference_bat(stk, pci, 0), *bid = getArgReference_bat(stk, pci, 1),
     389          13 :                 *sid = pci->argc == 3 ? getArgReference_bat(stk, pci, 2) : NULL;
     390             : 
     391             :         (void) cntxt;
     392             :         (void) mb;
     393          13 :         if (!(b = BBPquickdesc(*bid))) {
     394           0 :                 msg = createException(MAL, "batmmath.rand", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
     395           0 :                 goto bailout;
     396             :         }
     397          13 :         if (sid && !is_bat_nil(*sid) && !(bs = BATdescriptor(*sid))) {
     398           0 :                 msg = createException(MAL, "batmmath.rand", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
     399           0 :                 goto bailout;
     400             :         }
     401          13 :         q = canditer_init(&ci, b, bs);
     402          13 :         if (!(bn = COLnew(ci.hseq, TYPE_int, q, TRANSIENT))) {
     403           0 :                 msg = createException(MAL, "batmmath.rand", SQLSTATE(HY013) MAL_MALLOC_FAIL);
     404           0 :                 goto bailout;
     405             :         }
     406             : 
     407          13 :         vals = Tloc(bn, 0);
     408             : #ifdef __COVERITY__
     409             :         for (BUN i = 0; i < q; i++)
     410             :                 vals[i] = 0;
     411             : #else
     412          13 :         MT_lock_set(&mmath_rse_lock);
     413        5058 :         for (BUN i = 0; i < q; i++)
     414        5045 :                 vals[i] = (int) (next(mmath_rse) >> 33);
     415          13 :         MT_lock_unset(&mmath_rse_lock);
     416             : #endif
     417             : 
     418          13 : bailout:
     419          13 :         if (bs)
     420           0 :                 BBPunfix(bs->batCacheid);
     421          13 :         if (bn && !msg) {
     422          13 :                 BATsetcount(bn, q);
     423          13 :                 bn->tnil = false;
     424          13 :                 bn->tnonil = true;
     425          13 :                 bn->tkey = BATcount(bn) <= 1;
     426          13 :                 bn->tsorted = BATcount(bn) <= 1;
     427          13 :                 bn->trevsorted = BATcount(bn) <= 1;
     428          13 :                 BBPkeepref(*res = bn->batCacheid);
     429           0 :         } else if (bn)
     430           0 :                 BBPreclaim(bn);
     431          13 :         return msg;
     432             : }
     433             : 
     434           4 : scienceImpl(acos)
     435           1 : scienceImpl(asin)
     436           0 : scienceImpl(atan)
     437           6 : scienceImpl(cos)
     438           2 : scienceImpl(sin)
     439           0 : scienceImpl(tan)
     440           1 : scienceImpl(cot)
     441           0 : scienceImpl(cosh)
     442           5 : scienceImpl(sinh)
     443           0 : scienceImpl(tanh)
     444           4 : scienceImpl(radians)
     445           5 : scienceImpl(degrees)
     446          12 : scienceImpl(exp)
     447          17 : scienceImpl(log)
     448           2 : scienceImpl(log10)
     449           0 : scienceImpl(log2)
     450          18 : scienceImpl(sqrt)
     451           3 : scienceImpl(cbrt)
     452           5 : scienceImpl(ceil)
     453           0 : scienceImpl(fabs)
     454          32 : scienceImpl(floor)
     455             : 
     456           1 : scienceBinaryImpl(atan2)
     457           5 : scienceBinaryImpl(pow)
     458           0 : scienceBinaryImpl(logbs)
     459             : 
     460             : #include "mel.h"
     461             : mel_func batmmath_init_funcs[] = {
     462             :  pattern("batmmath", "asin", CMDscience_bat_asin, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     463             :  pattern("batmmath", "asin", CMDscience_bat_asin, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     464             :  pattern("batmmath", "asin", CMDscience_bat_asin, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     465             :  pattern("batmmath", "asin", CMDscience_bat_asin, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     466             :  pattern("batmmath", "acos", CMDscience_bat_acos, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     467             :  pattern("batmmath", "acos", CMDscience_bat_acos, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     468             :  pattern("batmmath", "acos", CMDscience_bat_acos, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     469             :  pattern("batmmath", "acos", CMDscience_bat_acos, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     470             :  pattern("batmmath", "atan", CMDscience_bat_atan, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     471             :  pattern("batmmath", "atan", CMDscience_bat_atan, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     472             :  pattern("batmmath", "atan", CMDscience_bat_atan, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     473             :  pattern("batmmath", "atan", CMDscience_bat_atan, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     474             :  pattern("batmmath", "cos", CMDscience_bat_cos, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     475             :  pattern("batmmath", "cos", CMDscience_bat_cos, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     476             :  pattern("batmmath", "cos", CMDscience_bat_cos, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     477             :  pattern("batmmath", "cos", CMDscience_bat_cos, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     478             :  pattern("batmmath", "sin", CMDscience_bat_sin, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     479             :  pattern("batmmath", "sin", CMDscience_bat_sin, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     480             :  pattern("batmmath", "sin", CMDscience_bat_sin, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     481             :  pattern("batmmath", "sin", CMDscience_bat_sin, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     482             :  pattern("batmmath", "tan", CMDscience_bat_tan, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     483             :  pattern("batmmath", "tan", CMDscience_bat_tan, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     484             :  pattern("batmmath", "tan", CMDscience_bat_tan, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     485             :  pattern("batmmath", "tan", CMDscience_bat_tan, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     486             :  pattern("batmmath", "cot", CMDscience_bat_cot, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     487             :  pattern("batmmath", "cot", CMDscience_bat_cot, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     488             :  pattern("batmmath", "cot", CMDscience_bat_cot, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     489             :  pattern("batmmath", "cot", CMDscience_bat_cot, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     490             :  pattern("batmmath", "cosh", CMDscience_bat_cosh, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     491             :  pattern("batmmath", "cosh", CMDscience_bat_cosh, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     492             :  pattern("batmmath", "cosh", CMDscience_bat_cosh, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     493             :  pattern("batmmath", "cosh", CMDscience_bat_cosh, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     494             :  pattern("batmmath", "sinh", CMDscience_bat_sinh, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     495             :  pattern("batmmath", "sinh", CMDscience_bat_sinh, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     496             :  pattern("batmmath", "sinh", CMDscience_bat_sinh, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     497             :  pattern("batmmath", "sinh", CMDscience_bat_sinh, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     498             :  pattern("batmmath", "tanh", CMDscience_bat_tanh, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     499             :  pattern("batmmath", "tanh", CMDscience_bat_tanh, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     500             :  pattern("batmmath", "tanh", CMDscience_bat_tanh, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     501             :  pattern("batmmath", "tanh", CMDscience_bat_tanh, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     502             :  pattern("batmmath", "radians", CMDscience_bat_radians, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     503             :  pattern("batmmath", "radians", CMDscience_bat_radians, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     504             :  pattern("batmmath", "radians", CMDscience_bat_radians, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     505             :  pattern("batmmath", "radians", CMDscience_bat_radians, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     506             :  pattern("batmmath", "degrees", CMDscience_bat_degrees, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     507             :  pattern("batmmath", "degrees", CMDscience_bat_degrees, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     508             :  pattern("batmmath", "degrees", CMDscience_bat_degrees, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     509             :  pattern("batmmath", "degrees", CMDscience_bat_degrees, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     510             :  pattern("batmmath", "exp", CMDscience_bat_exp, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     511             :  pattern("batmmath", "exp", CMDscience_bat_exp, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     512             :  pattern("batmmath", "exp", CMDscience_bat_exp, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     513             :  pattern("batmmath", "exp", CMDscience_bat_exp, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     514             :  pattern("batmmath", "log", CMDscience_bat_log, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     515             :  pattern("batmmath", "log", CMDscience_bat_log, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     516             :  pattern("batmmath", "log", CMDscience_bat_log, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     517             :  pattern("batmmath", "log", CMDscience_bat_log, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     518             :  pattern("batmmath", "log10", CMDscience_bat_log10, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     519             :  pattern("batmmath", "log10", CMDscience_bat_log10, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     520             :  pattern("batmmath", "log10", CMDscience_bat_log10, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     521             :  pattern("batmmath", "log10", CMDscience_bat_log10, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     522             :  pattern("batmmath", "log2", CMDscience_bat_log2, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     523             :  pattern("batmmath", "log2", CMDscience_bat_log2, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     524             :  pattern("batmmath", "log2", CMDscience_bat_log2, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     525             :  pattern("batmmath", "log2", CMDscience_bat_log2, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     526             :  pattern("batmmath", "log2arg", CMDscience_bat_logbs, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),arg("y",dbl))),
     527             :  pattern("batmmath", "log2arg", CMDscience_bat_logbs, false, "", args(1,4, batarg("",dbl),batarg("x",dbl),arg("y",dbl),batarg("s",oid))),
     528             :  pattern("batmmath", "log2arg", CMDscience_bat_logbs, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("y",dbl))),
     529             :  pattern("batmmath", "log2arg", CMDscience_bat_logbs, false, "", args(1,5, batarg("",dbl),batarg("x",dbl),batarg("y",dbl),batarg("s1",oid),batarg("s2",oid))),
     530             :  pattern("batmmath", "log2arg", CMDscience_bat_logbs, false, "", args(1,3, batarg("",flt),batarg("x",flt),arg("y",flt))),
     531             :  pattern("batmmath", "log2arg", CMDscience_bat_logbs, false, "", args(1,4, batarg("",flt),batarg("x",flt),arg("y",flt),batarg("s",oid))),
     532             :  pattern("batmmath", "log2arg", CMDscience_bat_logbs, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("y",flt))),
     533             :  pattern("batmmath", "log2arg", CMDscience_bat_logbs, false, "", args(1,5, batarg("",flt),batarg("x",flt),batarg("y",flt),batarg("s1",oid),batarg("s2",oid))),
     534             :  pattern("batmmath", "log2arg", CMDscience_bat_logbs, false, "", args(1,3, batarg("",dbl),arg("x",dbl),batarg("y",dbl))),
     535             :  pattern("batmmath", "log2arg", CMDscience_bat_logbs, false, "", args(1,4, batarg("",dbl),arg("x",dbl),batarg("y",dbl),batarg("s",oid))),
     536             :  pattern("batmmath", "log2arg", CMDscience_bat_logbs, false, "", args(1,3, batarg("",flt),arg("x",flt),batarg("y",flt))),
     537             :  pattern("batmmath", "log2arg", CMDscience_bat_logbs, false, "", args(1,4, batarg("",flt),arg("x",flt),batarg("y",flt),batarg("s",oid))),
     538             :  pattern("batmmath", "sqrt", CMDscience_bat_sqrt, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     539             :  pattern("batmmath", "sqrt", CMDscience_bat_sqrt, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     540             :  pattern("batmmath", "sqrt", CMDscience_bat_sqrt, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     541             :  pattern("batmmath", "sqrt", CMDscience_bat_sqrt, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     542             :  pattern("batmmath", "cbrt", CMDscience_bat_cbrt, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     543             :  pattern("batmmath", "cbrt", CMDscience_bat_cbrt, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     544             :  pattern("batmmath", "cbrt", CMDscience_bat_cbrt, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     545             :  pattern("batmmath", "cbrt", CMDscience_bat_cbrt, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     546             :  pattern("batmmath", "ceil", CMDscience_bat_ceil, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     547             :  pattern("batmmath", "ceil", CMDscience_bat_ceil, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     548             :  pattern("batmmath", "ceil", CMDscience_bat_ceil, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     549             :  pattern("batmmath", "ceil", CMDscience_bat_ceil, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     550             :  pattern("batmmath", "fabs", CMDscience_bat_fabs, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     551             :  pattern("batmmath", "fabs", CMDscience_bat_fabs, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     552             :  pattern("batmmath", "fabs", CMDscience_bat_fabs, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     553             :  pattern("batmmath", "fabs", CMDscience_bat_fabs, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     554             :  pattern("batmmath", "floor", CMDscience_bat_floor, false, "", args(1,2, batarg("",dbl),batarg("x",dbl))),
     555             :  pattern("batmmath", "floor", CMDscience_bat_floor, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("s",oid))),
     556             :  pattern("batmmath", "floor", CMDscience_bat_floor, false, "", args(1,2, batarg("",flt),batarg("x",flt))),
     557             :  pattern("batmmath", "floor", CMDscience_bat_floor, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("s",oid))),
     558             :  pattern("batmmath", "atan2", CMDscience_bat_atan2, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),arg("y",dbl))),
     559             :  pattern("batmmath", "atan2", CMDscience_bat_atan2, false, "", args(1,4, batarg("",dbl),batarg("x",dbl),arg("y",dbl),batarg("s",oid))),
     560             :  pattern("batmmath", "atan2", CMDscience_bat_atan2, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("y",dbl))),
     561             :  pattern("batmmath", "atan2", CMDscience_bat_atan2, false, "", args(1,5, batarg("",dbl),batarg("x",dbl),batarg("y",dbl),batarg("s1",oid),batarg("s2",oid))),
     562             :  pattern("batmmath", "atan2", CMDscience_bat_atan2, false, "", args(1,3, batarg("",flt),batarg("x",flt),arg("y",flt))),
     563             :  pattern("batmmath", "atan2", CMDscience_bat_atan2, false, "", args(1,4, batarg("",flt),batarg("x",flt),arg("y",flt),batarg("s",oid))),
     564             :  pattern("batmmath", "atan2", CMDscience_bat_atan2, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("y",flt))),
     565             :  pattern("batmmath", "atan2", CMDscience_bat_atan2, false, "", args(1,5, batarg("",flt),batarg("x",flt),batarg("y",flt),batarg("s1",oid),batarg("s2",oid))),
     566             :  pattern("batmmath", "atan2", CMDscience_bat_atan2, false, "", args(1,3, batarg("",dbl),arg("x",dbl),batarg("y",dbl))),
     567             :  pattern("batmmath", "atan2", CMDscience_bat_atan2, false, "", args(1,4, batarg("",dbl),arg("x",dbl),batarg("y",dbl),batarg("s",oid))),
     568             :  pattern("batmmath", "atan2", CMDscience_bat_atan2, false, "", args(1,3, batarg("",flt),arg("x",flt),batarg("y",flt))),
     569             :  pattern("batmmath", "atan2", CMDscience_bat_atan2, false, "", args(1,4, batarg("",flt),arg("x",flt),batarg("y",flt),batarg("s",oid))),
     570             :  pattern("batmmath", "pow", CMDscience_bat_pow, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),arg("y",dbl))),
     571             :  pattern("batmmath", "pow", CMDscience_bat_pow, false, "", args(1,4, batarg("",dbl),batarg("x",dbl),arg("y",dbl),batarg("s",oid))),
     572             :  pattern("batmmath", "pow", CMDscience_bat_pow, false, "", args(1,3, batarg("",dbl),batarg("x",dbl),batarg("y",dbl))),
     573             :  pattern("batmmath", "pow", CMDscience_bat_pow, false, "", args(1,5, batarg("",dbl),batarg("x",dbl),batarg("y",dbl),batarg("s1",oid),batarg("s2",oid))),
     574             :  pattern("batmmath", "pow", CMDscience_bat_pow, false, "", args(1,3, batarg("",flt),batarg("x",flt),arg("y",flt))),
     575             :  pattern("batmmath", "pow", CMDscience_bat_pow, false, "", args(1,4, batarg("",flt),batarg("x",flt),arg("y",flt),batarg("s",oid))),
     576             :  pattern("batmmath", "pow", CMDscience_bat_pow, false, "", args(1,3, batarg("",flt),batarg("x",flt),batarg("y",flt))),
     577             :  pattern("batmmath", "pow", CMDscience_bat_pow, false, "", args(1,5, batarg("",flt),batarg("x",flt),batarg("y",flt),batarg("s1",oid),batarg("s2",oid))),
     578             :  pattern("batmmath", "pow", CMDscience_bat_pow, false, "", args(1,3, batarg("",dbl),arg("x",dbl),batarg("y",dbl))),
     579             :  pattern("batmmath", "pow", CMDscience_bat_pow, false, "", args(1,4, batarg("",dbl),arg("x",dbl),batarg("y",dbl),batarg("s",oid))),
     580             :  pattern("batmmath", "pow", CMDscience_bat_pow, false, "", args(1,3, batarg("",flt),arg("x",flt),batarg("y",flt))),
     581             :  pattern("batmmath", "pow", CMDscience_bat_pow, false, "", args(1,4, batarg("",flt),arg("x",flt),batarg("y",flt),batarg("s",oid))),
     582             :  pattern("batmmath", "rand", CMDscience_bat_randintarg, true, "", args(1,2, batarg("",int),batarg("v",int))),
     583             :  pattern("batmmath", "rand", CMDscience_bat_randintarg, true, "", args(1,3, batarg("",int),batarg("v",int),batarg("s",oid))),
     584             :  { .imp=NULL }
     585             : };
     586             : #include "mal_import.h"
     587             : #ifdef _MSC_VER
     588             : #undef read
     589             : #pragma section(".CRT$XCU",read)
     590             : #endif
     591         259 : LIB_STARTUP_FUNC(init_batmmath_mal)
     592         259 : { mal_module("batmmath", NULL, batmmath_init_funcs); }

Generated by: LCOV version 1.14