From owner-freebsd-bugs Wed Jul 8 14:31:08 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA01323 for freebsd-bugs-outgoing; Wed, 8 Jul 1998 14:31:08 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.15.68.22]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA01318 for ; Wed, 8 Jul 1998 14:31:04 -0700 (PDT) (envelope-from bde@godzilla.zeta.org.au) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.7/8.8.7) id HAA14372; Thu, 9 Jul 1998 07:30:53 +1000 Date: Thu, 9 Jul 1998 07:30:53 +1000 From: Bruce Evans Message-Id: <199807082130.HAA14372@godzilla.zeta.org.au> To: freebsd-bugs@FreeBSD.ORG, r.carey@dcs.napier.ac.uk, rotel@indigo.ie Subject: mount, floating point Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >> 1) "mount_msdos /dev/fd0a /floppy/" Don't do that. Use `mount -t msdos ...'. mount(8) calls realpath() to canonicalize the path, while mount_msdos(8) passes the path unchanged to mount(2). The path is stored by the kernel and if it is non-canonical then it may confuse things later. >> 2) "umount /floppy/": not currently mounted >> 3) "umount /floppy": not currently mounted It does confuse things later :-). I think (2) should work but (3) shouldn't. umount already does one stat() too many, at least for umount -f (the stat() may hang on nfs mount points before giving unmount() a chance). realpath() would be more likely to hang. >> typedef double REAL; >> # define DIG DBL_DIG > >The bug is in your understanding of meaning of the DBL_DIG macro; >see http://www.dinkumware.com/htm_cl/float.html. Change the above >to: > >#define DIG DBL_MANT_DIG > >and try again. DBL_MANT_DIG is irrelevant (it's for base 2). Try (DBL_DIG + 2). Assuming that printf gets this right (I think it does) then the exact value is d = 2.999...5x... where `5x' occurs DBL_DIG = 15 digits to the right of the decimal point. l = (unsigned)d is 2 because the assignment rounes towards 0, while printf in %.15f format gives 3.000... because printf rounds to neares and the value is a bit closer to precisely 3 than it is to 2.999...999 (DBL_DIG 9's). Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message