use strict; use warnings; use feature 'say'; use Alien::GSL; use Math::GSL; use Math::GSL::SparseMatrix ':all'; my $m = gsl_spmatrix_alloc( 1, 1 ); my $v; #$v = 3 + (1 << 32); # no problem with this value #$v = 2 + (1 << 32); # no problem with this value #$v = 0 + (1 << 32); # no problem with this value $v = 1 + (1 << 32); # blows up, but only if # gsl_spmatrix_get($m, $v, 0) # is called. die if gsl_spmatrix_set( $m, 1, 0, 1.5 ); say gsl_spmatrix_get($m, 1, 0); say gsl_spmatrix_nnz( $m ); die if gsl_spmatrix_set( $m, $v, 0, 1.75 ); say gsl_spmatrix_get($m, $v, 0); # comment out to avoid blow up # when $v is 1 + (1 << 32). # But still gives wrong result # (for that value only). say gsl_spmatrix_nnz( $m );