simple calculator

Scott Berry scott at drscott.dyndns.biz
Fri Feb 27 02:53:08 UTC 2004


Hey this is exactly what I needed and you have it set up perfectly.
Thanks much.

On Thu, 26 Feb 2004, A. R. Vener wrote:

> Here is a quick and  dirty multi precision calculator
> which I just knocked off in perl.
> It will evaluate and print any reasonable  math string including
> perls built in math functions such as  sqrt, log, sin cos  and so forth.
>
> You can change precision by putting a entering a p followed by the number of
> decimal positions  you want displayed. I default to 2 for money related
> calculations.
> Just be sure yyour version of perl is correctly pointed to by the first line.
>
> Have fun.
>
> Rudy
>
>
> -----------------cut here-----------------------
> #!//usr/bin/perl
>
>
> $prec=2;
> while (<STDIN>)
> {
> chomp $_;
> /^q/ and exit;
> /^p/ and s/^p *// and $prec = $_ and next;
> $rv= eval "$_";
> printf ("%.${prec}f\n", $rv);
> }
>
>
> _______________________________________________
> Blinux-list mailing list
> Blinux-list at redhat.com
> https://www.redhat.com/mailman/listinfo/blinux-list
>





More information about the Blinux-list mailing list