Math::Pari、Pari/GP 用の perl インターフェイスに依存する perl 用の Crypt::Random モジュールを使用して乱数を生成していましたが、1.5M 桁の数字を生成しようとすると次のエラーが発生しました。
C:\Users\Jlinne\Documents>perl -MCrypt::Random=makerandom_itv -E "say makerandom_itv(Lower => '10^1499999', Upper => '10^1500000')" > num_1500000.txt
PARI: *** the PARI stack overflows !
current stack size: 4.0 Mbytes
[hint] you can increase GP stack with allocatemem()
C:\Users\Ryan\Documents\Perl Scripts>perl scripts1.pl
"use" not allowed in expression at scripts1.pl line 6, at end of line
syntax error at scripts1.pl line 6, near "use Math::Pari
use Math::PariInit "
BEGIN not safe after errors--compilation aborted at scripts1.pl line 7.
私のスクリプト:
#!/usr/bin/env perl
use warnings;
use strict;
use feature 'say';
use Math::Pari
use Math::PariInit qw( primes=12000000 stack=1e8 );
use Crypt::Random
allocatemem() 関数は Math::Pari 関数だと思っていましたが、そうではありません。ワンライナーと比較して、スクリプトを使用して GP スタック サイズを 8.0 M バイトに変更する方法を知っている人はいますか? ありがとう。
1e+32 へのスタックの問題
C:\Users\Jlinne\Documents\Perl Scripts>perl scripts1.pl > BIGINT1500000.txt
PARI: *** the PARI stack overflows !
current stack size: 0.0 Mbytes
[hint] you can increase GP stack with allocatemem()
Compilation failed in require at C:/Strawberry/perl/site/lib/Math/PariInit.pm line 26.
BEGIN failed--compilation aborted at scripts1.pl line 6.
脚本:
use warnings 'all';
use strict;
use feature 'say';
# use Math::Pari;
use Math::PariInit qw( stack=1e32 );
use Crypt::Random qw(makerandom_itv);
say makerandom_itv(Lower => '10^1499999', Upper => '10^1500000');