https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270154
Bug ID: 270154
Summary: bc freezes evaluating cbrt(0.01)
Product: Base System
Version: 13.1-RELEASE
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: bin
Assignee: [email protected]
Reporter: [email protected]
bin/bc enters an infinite loop while evaluating the cube-root of 0.01
bin/bc -l -e 'cbrt(0.1)'
returns .46415888336127788924 (which is expected)
bin/bc -l -e 'cbrt(0.01)'
freezes
Looking at the definition of root(x,n) in lib2.bc the following loop never
exits
while(r!=q){
r=q
q=(p*r+x/r^p)/n
}
A simple hack makes the cbrt function working.
while(abs(r-q)>0.000001){
r=q
q=(p*r+x/r^p)/n
}
--
You are receiving this mail because:
You are the assignee for the bug.