Date: Thu, 9 Jul 1998 07:30:53 +1000 From: Bruce Evans <bde@zeta.org.au> To: freebsd-bugs@FreeBSD.ORG, r.carey@dcs.napier.ac.uk, rotel@indigo.ie Subject: mount, floating point Message-ID: <199807082130.HAA14372@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199807082130.HAA14372>