Date: Sun, 12 Mar 2023 13:12:24 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 270154] bc freezes evaluating cbrt(0.01) Message-ID: <bug-270154-227@https.bugs.freebsd.org/bugzilla/>
index | next in thread | raw e-mail
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: bugs@FreeBSD.org Reporter: igor@kolesnik.es 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.home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-270154-227>
