diff --git a/rpn b/rpn index 927db1f..e8ed2f4 100755 --- a/rpn +++ b/rpn @@ -43,6 +43,20 @@ while (<>) { } elsif (m{^ld$}) { my $x = pop @stack; push @stack, log($x) / log(2); + } elsif (m{^sin$}) { + my $x = pop @stack; + push @stack, sin($x); + } elsif (m{^cos$}) { + my $x = pop @stack; + push @stack, cos($x); + } elsif (m{^tan$}) { + my $x = pop @stack; + push @stack, tan($x); + } elsif (m{^e$}) { + push @stack, exp(1); + } elsif (m{^exp$}) { + my $x = pop @stack; + push @stack, exp($x); } elsif (m{^0x[0-9a-fA-F]+$}) { no warnings 'portable'; push @stack, hex($_);