ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
expr ^ expr The result of the expression is the value of the first raised to the second. The second expression must be an integer. (If the second expression is not an integer, a warning is generated and the expression is truncated to get an integer value.)
So is there anyway to calculate cube root in bc? or may be expr ?
Well personally I would say it is a big call to ask for help and then dismiss the answer!!
Probably you misinterprit me....as(i guess)english is not my native language.
What i meant is i tried michaelk's method(and conclude the impossiblity) before posting in this forum.
After getting his reply I retried and succeed.
I am sorry if I hurt some one (michaelk or other who helped).
Thank you
After googling for bc third root the first suggestion was this thread .
I stumbled about two and a half problems :
1) Since I never had to use the -l --mathlib option to bc, I did not use it .
2) I wrongly read the letter ' small "L" ' at http://phodd.net/gnu-bc/bcfaq.html#bccbrt
as it states
Code:
echo 'e(l({number})/3)' | bc -l
as a ' number ONE "1" '
3) I also used {number} or {27} instead of just 27 .
Code:
bash-3.2# bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
e(l(27)/3)
Runtime error (func=(main), adr=6): Function l not defined.
quit
bash-3.2# bc -l
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
e(l(27)/3)
2.99999999999999999998
quit
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.