Subject Problem with double precision in UDFs
Author lutterot
Hi!

I have written a simple UDF, which gets a double value and should
return it:

DECLARE EXTERNAL FUNCTION RETURN_DOUBLE
DOUBLE PRECISION BY DESCRIPTOR
RETURNS DOUBLE PRECISION FREE_IT
ENTRY_POINT 'udf_return_double' MODULE_NAME 'my_udf_lib';

double* udf_return_double(PARAMDSC* par)
{
if(!par || (par->dsc_flags & DSC_null)) return 0;
double* value = (double*) par->dsc_address;
double* result = ib_util_malloc(8);

*result = *value;

return result;
}

Now I am trying to call it like this:

select return_double(1.0) from RDB$CHARACTER_SETS

And the result I get is 0. Why is that?
Thanks in advance.

Cheers,
Christof