hex and oct numbers
This commit is contained in:
parent
ac9719ad57
commit
9d590f521c
6
rpn
6
rpn
|
@ -41,6 +41,12 @@ while (<>) {
|
||||||
} elsif (m{^ld$}) {
|
} elsif (m{^ld$}) {
|
||||||
my $x = pop @stack;
|
my $x = pop @stack;
|
||||||
push @stack, log($x) / log(2);
|
push @stack, log($x) / log(2);
|
||||||
|
} elsif (m{^0x[0-9a-fA-F]+$}) {
|
||||||
|
no warnings 'portable';
|
||||||
|
push @stack, hex($_);
|
||||||
|
} elsif (m{^0[0-7]+$}) {
|
||||||
|
no warnings 'portable';
|
||||||
|
push @stack, oct($_);
|
||||||
} else {
|
} else {
|
||||||
push @stack, $_;
|
push @stack, $_;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue