On Tue, Mar 5, 2013 at 7:39 AM, David Loeffler
<d.a.loeff...@warwick.ac.uk> wrote:
> On 5 March 2013 06:54, Peng Tian <tianpeng.ch...@gmail.com> wrote:
>> Dear David,
>> You are right. I tried to change the data type of the code in sage, which is
>> "int" type in the source code of SAGE and now I'm using "long int" instead.
>> The previous error is gone and everything is working well now.
>>
>> Thanks a lot!
>>
>> Best regards!
>> Peng
>>
>
> Dear Peng,
>
> Using long ints is a sound temporary fix, I guess. It would have the
> side-effect of making the small N cases slightly slower and more
> memory-hungry, so it might be best to have two separate functions in
> the code, one using ints and the other longs, and choose between them
> according to whether N^2 > 2^{31} or not; we already do similar things
> for some other related functions, e.g lift_to_sl2z(). You could even
> write a patch for this and upload it to Sage's trac server; then
> that'll prevent anyone else having this problem in the future.
>
> In an ideal world we'd also want a third implementation that uses MPIR
> arbitrary-precision integers; this will be necessary when N is
> *really* big, i.e. N^2 > 2^{63}. But I suspect that nobody's going to
> be calculating Heilbronn matrices for such big N for a long while yet.

Looking at the original error "RuntimeError: Floating point exception"
does raise some concerns about blindly switching to long int; if
there's floating point involved all ints can be represented exactly as
doubles, but not all longs. I have not, however, looked at at the code
at all. When this gets fixed in Sage I'd like to see an explicit check
for the limit rather than crashing deep in the bowels of the code (or
worse, returning a wrong answer due to rounding or something).

- Robert

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to