Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ucla-cs!sdcrdcf!pmontgom From: pmontgom@sdcrdcf.UUCP (Peter Montgomery) Newsgroups: comp.bugs.4bsd,sci.math.symbolic Subject: Bug in bc square root routine Message-ID: <4534@sdcrdcf.UUCP> Date: Sun, 26-Apr-87 19:05:20 EDT Article-I.D.: sdcrdcf.4534 Posted: Sun Apr 26 19:05:20 1987 Date-Received: Mon, 27-Apr-87 03:44:57 EDT Reply-To: pmontgom@sdcrdcf.UUCP (Peter Montgomery) Distribution: world Organization: UNISYS, Santa Monica Lines: 25 Xref: mnetor comp.bugs.4bsd:328 sci.math.symbolic:69 The following bc program prints (comments added by me) 999999996999999999700000000001 (b = actual square root) 999999994000000008400000001802000000083999999999400000000001 (c = square) 999999996999999999699950000000 (d = computed square root) 50000001 (b-d = difference) The problem exists both on a VAX 780 using 4.2bsd and on a SUN 2/170 using SUN release 3.0. a = 10^10 b = 1 - 30*a - 30*a^2 + a^3 c = b^2 d = sqrt(c) b c d b-d quit -- Peter Montgomery {aero,allegra,bmcg,burdvax,hplabs,ihnp4, psivax,randvax,sdcsvax,trwrb}!sdcrdcf!pmontgom Don't blame me for the crowded freeways - I don't drive.