Bill Allombert on Tue, 11 Oct 2016 18:54:58 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

install and functions returning NULL


Dear PARI developers,

I found an awful trick to be able to install C functions returning NULL:
NULL is used in the gp evaluator to denote missing arguments so
null0(a=0)=a 
will convert NULL to 0.

For example:

install(Fp_sqrt,GG);
null0(a=0)=a;
mysqrt(a,b)=null0(Fp_sqrt(a,b));
? mysqrt(-1,7)
%4 = 0
? mysqrt(-3,7)
%5 = 2

Cheers,
Bill.