Pi: correct parsing for max length (#4441)
* Pi: correct parsing for max length * small style fix * fix for pi 1000master
parent
b7de67c5bd
commit
171ef55def
|
@ -22,12 +22,12 @@ my $PI = '3.14159265358979323846264338327950288419716939937510582097494459230781
|
|||
'147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216'.
|
||||
'4201989';
|
||||
|
||||
my $PI_max_digits = length($PI);
|
||||
my $PI_max_digits = length($PI) - 2;
|
||||
|
||||
handle query_raw => sub {
|
||||
|
||||
return unless $_ =~ /^(?:pi|π)?\s*(?:to|first)?\s*(?<decimal>\d+)\s*(?:(?:decimal|digit)s?)?\s*(?:of\s+(?:pi|π))?$/i &&
|
||||
$+{decimal} > 0 && $+{decimal} < $PI_max_digits;
|
||||
$+{decimal} > 0 && $+{decimal} <= $PI_max_digits;
|
||||
|
||||
my $answer = substr $PI, 0, ( $1 + 2 );
|
||||
return $answer, structured_answer => {
|
||||
|
|
Loading…
Reference in New Issue