I defined the cbrt function to return a cube root. I need to get an integer back (even if it is close to the cube root, it will be acceptable in my case). However, when I put the scale as 0 to get an integer, I get numbers which are grossly incorrect. What is going on and how do I get an integer cube root out?
bc -l
define cbrt(x) { return e(l(x)/3) }
scale=1;cbrt(1000000)
99.4
scale=0;cbrt(1000000)
54
scale
take effect is divide by 1. – x-yuri Dec 05 '18 at 16:51