From owner-freebsd-bugs Fri Oct 17 21:02:13 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id VAA25828 for bugs-outgoing; Fri, 17 Oct 1997 21:02:13 -0700 (PDT) (envelope-from owner-freebsd-bugs) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id VAA25812 for ; Fri, 17 Oct 1997 21:02:07 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.7/8.6.9) id NAA08402; Sat, 18 Oct 1997 13:58:54 +1000 Date: Sat, 18 Oct 1997 13:58:54 +1000 From: Bruce Evans Message-Id: <199710180358.NAA08402@godzilla.zeta.org.au> To: bugs@FreeBSD.ORG, mike@NetworX.ie Subject: Re: Rounding up is -odd- Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >Why does > printf "%1.2f\n" 7.005 >produce > 7.00 >while > printf "%1.2f\n" 8.005 >produces > 8.01 >? For the same reason that printf "%1.20f\n" 7.005 produces 7.00499999999999989342 and printf "%1.20f\n" 8.005 produces 8.00500000000000078160 (double)7.005 isn't actually 7.005, since doubles have a finite amount of precision and 7.005 is not exactly representable. Bruce