[GAP Forum] "IsRationalNumber" as synonym for "IsRat"
Alexander Konovalov
alexk at mcs.st-andrews.ac.uk
Sat Feb 25 09:44:28 GMT 2012
On 25 Feb 2012, at 06:13, Asst. Prof. Dmitrii (Dima) Pasechnik wrote:
> Dear all,
>
> it seems to me that functions like IsRat, etc are an artefact of very
> old GAP versions, which lacked proper typing (I guess --- I started
> using GAP almost 20 years ago, and I don't recall such details).
> Instead of calling IsRat(x), one nowadays is better served by
> containment predicate like
> x in Rationals
Just to warn the Forum that internally this results in different things
so in the long run the performance may be not the same:
gap> for i in [1..10000000] do t := IsRat(42); od; time;
623
gap> for i in [1..10000000] do t := 42 in Rationals; od; time;
1861
though on a few calls the difference is unnoticeable.
Best,
Alexander
More information about the Forum
mailing list