str
UDFbitand(long long int a, long long b)
{
long long int weirdAnd(unsigned int a, unsigned int b) {
long long int result = 0;
int coef = 1;
while (a || b) {
result += ((a % 10) && (b % 10)) * coef;
coef *= 10;
a /= 10;
b /= 10;
}
return result;
}
long long int temp = weirdAnd(a, b);
long long int temp2 = weirdAnd(a, b);
int length;
int count;
while (temp != 0)
{
temp/=10;
length++;
}
while (temp2 != 0) {
if (temp2 % 10 == 1)
count++;
temp2 /= 10;
}
float final = count/(float)length;
return MAL_SUCCEED;
}
create function bitand(a BIGINT,b BIGINT)
returns REAL external name udf.bitand;
When I test my C code in netbeans it works as supposed. Any ideas? Thanks in advance.