Bill Allombert on Sun, 30 May 2004 22:56:13 +0200


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

Re: reporting the GP name of functions in error message


On Wed, Mar 10, 2004 at 11:31:03PM +0100, Bill Allombert wrote:
> Hello PARI-dev,
> 
> I tried to implement reporting of the GP name of the function called
> where an error occur in the new parser, but I found it could be done
> the same way with the current parser, so here a patch.
> 
> It is for evaluation purpose, it could be perfected.
> 
> With this patch, we get for example:
> ? cotan(0)
>   *** cotan: division by zero in R/R
> 
> instead of
> ? cotan(0)
>   ***   division by zero in R/R
> 
> or
> ? for(i=2,100,factormod(x^4+1,i))
>   *** factormod: composite modulus in mpsqrtmod: 9.
> 
> instead of
> 
> ? for(i=2,100,factormod(x^4+1,i))
>   ***   composite modulus in mpsqrtmod: 9.
> 
> which is less confusing when it appear inside a large GP routine.

Well, I have commited this patch.

We might want to extend it to be able to report user functions name
as well, like in
? f(x)=1/x
? f(0)
  *** f: division by zero in gdiv, gdivgs or ginv
  
but I am not sure it is practical without a call stack, since e.g.

? f(x)=cotan(x)
? f(0)
  *** cotan: division by zero in R/R

will not talk about f.

Note that in library mode, you will always get traditional error
messages.

Cheers,
Bill.