| Bill Allombert on Wed, 09 May 2012 16:15:14 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: ispolygonal |
On Wed, May 09, 2012 at 02:20:52PM +0200, Karim Belabas wrote:
> * Bill Allombert [2012-05-08 23:34]:
> > I am experimenting with ispolygonal:
> >
> > ? ispolygonal(36,2)
> > *** at top-level: ispolygonal(36,2)
> > *** ^-----------------
> > *** ispolygonal: incorrect type in ispolygonal (t_INT).
> >
> > This is confusing since 2 is a t_INT.
>
> The rationale was to avoid the e_MISC error type [ which is essentially
> impossible to trap cleanly ], and consider that the expected input
> "type" was 'a t_INT in Z_{> 2}'.
>
> This is a bit far-fetched and potentially confusing, I temporarily changed
> it to e_MISC.
>
> Presumably we need a general error type for "violated inequality" ?
>
> pari_err(e_INEQ, "ispolygonal", "s > 2", s);
We could define
pari_err(e_TOOSMALL,"ispolygonal",s,gen_2)
--> "%s: %Ps must be > %Ps"
In practice I expect this would cover almost all case and allow the user
to retrieve the inequality.
Cheers,
Bill.