From owner-freebsd-questions@freebsd.org Wed Jan 13 04:22:50 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5074A80814 for ; Wed, 13 Jan 2016 04:22:50 +0000 (UTC) (envelope-from nibbana@gmx.us) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 25272195D for ; Wed, 13 Jan 2016 04:22:49 +0000 (UTC) (envelope-from nibbana@gmx.us) Received: from mail.gmx.com ([72.251.118.23]) by mail.gmx.com (mrgmx002) with ESMTPA (Nemesis) id 0MYwyp-1afQo70WSh-00VjUD for ; Wed, 13 Jan 2016 05:22:42 +0100 Date: Tue, 12 Jan 2016 19:23:36 -0900 From: "CK" To: Cc: Subject: dc(1) bugs Reply-To: "CK" X-Mailer: UMail v1.0 Message-ID: <0McVKy-1aajq60oIS-00Hgju@mail.gmx.com> X-Provags-ID: V03:K0:DYp2Pt3s/VH8zbeS0ZGZGo2eOvzgmqsGLr8DVOF0KZbuL0pOxRz 8H7MvV8Y4y5iuDP8zrP7ctrCv7kBp0G6gPahsHbfuKYGhMISLnVHvm9LqoEvDjhrMajqxCK HCjywi+qk25Ey9/mYIzgTnOOCdif/JnQh28Gwi2ChXC5qH2FULMLbg9Rbvic4GUzafkMEcl x4D4AgYH2a6kRarEobQLA== X-UI-Out-Filterresults: notjunk:1;V01:K0:xg4EhsjPEZA=:qSkos3BKlTGgw1gVfnqgY5 Nn5aUqcMe5hj1Nr4W0ADi5XLM+mtndvWI6jXkhJBQggVdNCSPJJ6i7QuOpeiajZb4WwB11yo7 G+V7itKSFCXyG3rKjYd9N3uay6Pbb+gadeobkVB3ykH8xbRSy4qa/hzLT525nNyBcnP5YFytf UvNhHIy0KxOLUWQ9COFxoju6eQtQWblQ1WtmqaMcpEkDOyQQeTLZj3mk+v0N34sTcVxaeQbp/ gE+ykf1kcqQvmZHO23jcAUCxjmMBHhgpfGGjxNzziIRK1t40QiG2ilAADYZV+0QsdFqtyGbxA 1f19qNWVnHloF2mvKDv/RA7DuR3DrkkgVUpn14aLDkkUwBCFpijIsr5S76Otq+nUFd+1VhgFA Hb8tYe4Fh/qF8rTD6LmE7A8xxEWaFVaKIOCcgrDW5f4Z+cEq3UMeHHG4UN9F+IRu80kfNalJK VZfLplChdXvpKupmsl6uf/MNa3E1d7QO+VqEaxXN1L8goqclWonL/6Wd1YBAS05faoHJJYJk0 F4K0run+CBWYdtOlkx5onjSxrJ+XnVa9f4WhbJoa8ykPC0lZ0tRkcS3asPhr67X21el9Q74S9 dkWAuNLj2pWAbMGyJ2Ia1kUIyqLEKiRhBPRWGm5XH4g0FbXWL3gQ1wcl6+8YByBq+w8bK6CES oYGJaqNrAoRgkvfBGGu7MajsvGIZ3r1/PslegOt+MqEvbO1gNxHW68kZ0fCQmOTLf/S7Ywk95 bwhHxtha/esvo28ZZbhkk8i0F2Zmc/8F7HMJddKv64tnEOFjwSpRyOYYG0s= X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jan 2016 04:22:50 -0000 FreeBSD-9.3 dc(1) These appear to be bugs to me, but please verify if possible: ##### FIRST ##### $ dc -xe '50k16o16i.1vp' 0 $ dc -xe '50k10o16i.1vp' 0 $ dc -xe '50k10o10i.1vp' 31622776601683793319988935444327185337195551393252 This should be telling dc(1): a) scale is 50 (in decimal) digits. b) output in base16, base10, and base10 respectively. c) input will be in base16, base16, and base10 respectively. d) take the square root, and print it to the display. Of course, the 3rd example above is correct, but the first 2? Why 0? ###### SECOND ###### $ dc -xe '50k16o16i.4 2^p' 0A $ dc -xe '50k16o16i.0Avp' 2C572B0D5A1443EC508B9E24D8DF392750959EE138 This should be telling dc(1): a) scale is 50 (in decimal) digits. b) output in base16, input is now base16. c) square "0.4", and print it to the display (result=0.0A). d) take the square-root of "0.0A", and print it to the display. Of course, the square-root of a squared number should result in the orginal number. But, this is not happening. ##### THIRD ##### $ dc -xe '50k16o16i.4 2^p' 0A $ dc -xe '50k16o16i.40 2^p' 1000 $ dc -xe '50k16o16i.400 2^p' 10000 $ dc -xe '50k16o16i.4000 2^p' 1000000 dc(1) is supposed to be precise in the digits it calculates, but here? Something is not right about these results, or so it appears to me. ###### FOURTH ###### $ dc -xe '50k16o16i.1vp' 0 $ dc -xe '50k16o16i.10vp' 3EB4F9D9B6D094C33D38373D38777A7D9233A1B0FB $ dc -xe '50k16o16i.100vp' 3FBE55183CA5ADC8B39B27C6258E4C7E64338B909F $ dc -xe '50k16o16i.1000vp' 400000000000000000000000000000000000000000 Checking the result of the THIRD example, dc(1) is not outputting to the scale specified, and despite having all a scale of 50, they are all giving different results with inputs having a scale of only 1/2/3/4; Something seems broken to me.