From owner-freebsd-questions Thu Jan 16 13:47:40 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B698C37B401 for ; Thu, 16 Jan 2003 13:47:39 -0800 (PST) Received: from giganda.komkon.org (giganda.komkon.org [63.167.241.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id CA64743F18 for ; Thu, 16 Jan 2003 13:47:38 -0800 (PST) (envelope-from ugen@xonix.com) Received: from xonix.com (root@giganda.komkon.org [63.167.241.66]) by giganda.komkon.org (8.11.3/8.11.3) with ESMTP id h0GLlbL51943 for ; Thu, 16 Jan 2003 16:47:37 -0500 (EST) (envelope-from ugen@xonix.com) Message-ID: <3E272874.8060706@xonix.com> Date: Thu, 16 Jan 2003 16:47:32 -0500 From: Ugen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2b) Gecko/20021016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-questions@FreeBSD.ORG Subject: printf prints WRONG double precision values Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Try this: #include int main() { double pi = 3.14159265358979323846 ; printf("%20.19f\n", pi); } and here is what you get: host: [16:45] [127] /tmp>./test 3.1415926535897931160 The error in last 4 or digits is obvious. It seems that the culprit is __dtoa which incorrectly turns double precision numbers into strings. This is on FreeBSD 4.3 release.. Ideas? --Ugen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message