shell-script-pt
[Top][All Lists]
Advanced

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

Re: [shell-script] Calculo de Seno,Cosseno em Shell Script


From: Tiago Peczenyj
Subject: Re: [shell-script] Calculo de Seno,Cosseno em Shell Script
Date: Sun, 5 Jun 2011 10:42:05 -0300

Exato, o bc pode resolver

PI, por exemplo, vc pode usar 4*a(1) e por ai vai. Outra opção é usar AWK.

Vc fará algo mais complexo que isto:
pi=$(echo "scale=10; 4*a(1)" | bc -l)


do man bc:


   MATH LIBRARY
       If bc is invoked with the -l option, a math library  is  preloaded
 and
       the  default  scale  is  set to 20.   The math functions will
calculate
       their results to the scale set at the time of  their  call.   The
 math
       library defines the following functions:

       s (x)  The sine of x, x is in radians.

       c (x)  The cosine of x, x is in radians.

       a (x)  The arctangent of x, arctangent returns radians.

       l (x)  The natural logarithm of x.

       e (x)  The exponential function of raising e to the value x.


2011/6/5 Cristiano Amaral <address@hidden>

>
>
> Faz um teste com bc, deve resolver...
>
>
> [As partes desta mensagem que não continham texto foram removidas]
>
>  
>



-- 
Tiago B. Peczenyj
Linux User #405772

http://pacman.blog.br


[As partes desta mensagem que não continham texto foram removidas]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]