LCOV - code coverage report
Current view: top level - monetdb5/modules/kernel - batmmath.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 181 304 59.5 %
Date: 2024-04-26 00:35:57 Functions: 20 28 71.4 %

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

Generated by: LCOV version 1.14