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
|
- To: pari-dev@pari.math.u-bordeaux.fr
- Subject: install and functions returning NULL
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Tue, 11 Oct 2016 18:54:51 +0200
- Delivery-date: Tue, 11 Oct 2016 18:54:58 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=math.u-bordeaux.fr; s=mail; t=1476204891; bh=M6WAIo5kK4QPc1Fc9jPWx5zreBpDB4SvR0CGIBW0FLY=; h=Date:From:To:Subject:From; b=UGw6ZpATLEmWBEWMbdj8e4sbGPWKCz+wvuYH0CMtP8bb7UNWZj+3drdDlpF7aSHOn TCgUkt1ZPbETl2S9AC5cUfRSfXiZXRt6mJ0iWatqXX9OYxOcmXL5J2JT7ZGXUEhvhu doxGXWoePlga9Z02l9UBK+Xk8Hces46hhQnLrR1k=
- Mail-followup-to: pari-dev@pari.math.u-bordeaux.fr
- User-agent: Mutt/1.5.23 (2014-03-12)
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.