Re: simple calculator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/blinux-list
>


_______________________________________________

Blinux-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/blinux-list

[Index of Archives]     [Linux Speakup]     [Fedora]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]