Re: [Boost-users] [BULK] Re: [BULK] [filesystem] function todetermineavailable space
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of me22 Sent: Monday, September 12, 2005 4:36 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [BULK] Re: [BULK] [filesystem] function todetermineavailable space
On 12/09/05, Sohail Somani
wrote: What about using a type that guarantees a certain amount instead of just "max" (which may vary)? Or equivalently, are we guaranteed that uintmax_t can hold, say one TB, on any platform that boost supports?
Even 1 TB isn't really safe. I know a number of people with more total storage than that.
How about a double? The imprecision shouldn't be a worry -- if you're beyond the range of a double's precision for free space then being off by even a few MB it doesn't matter and doubles are perfectly precise for small integral numbers. ( on x86 linux it seems my 64-bit doubles have 53 bits of mantissa meaning they're perfectly precise for anything less than 8192 TeraBytes. I don't know what the standard specifes though, and my 32-bit floats are only perfectly precise for under 16 MB. That being said, even the 32-bit float has a max of over 3e26 TB, so just saying the precision of the number returned is dependant on the precision of your platform's double would get around that, assuming of course we can assure that any rounding is done on the safe side. )
Also, the implementation could work internally in whatever it wants to keep perfect precision and just feed out a double at the end.
Great idea. I'm ok with this. What about platforms like linux or windows? What types do they use to report these stats?
"Sohail Somani"
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of me22 Sent: Monday, September 12, 2005 4:36 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [BULK] Re: [BULK] [filesystem] function todetermineavailable space
On 12/09/05, Sohail Somani
wrote: What about using a type that guarantees a certain amount instead of just "max" (which may vary)? Or equivalently, are we guaranteed that uintmax_t can hold, say one TB, on any platform that boost supports?
Even 1 TB isn't really safe. I know a number of people with more total storage than that.
How about a double? The imprecision shouldn't be a worry -- if you're beyond the range of a double's precision for free space then being off by even a few MB it doesn't matter and doubles are perfectly precise for small integral numbers. ( on x86 linux it seems my 64-bit doubles have 53 bits of mantissa meaning they're perfectly precise for anything less than 8192 TeraBytes. I don't know what the standard specifes though, and my 32-bit floats are only perfectly precise for under 16 MB. That being said, even the 32-bit float has a max of over 3e26 TB, so just saying the precision of the number returned is dependant on the precision of your platform's double would get around that, assuming of course we can assure that any rounding is done on the safe side. )
Also, the implementation could work internally in whatever it wants to keep perfect precision and just feed out a double at the end.
Great idea. I'm ok with this. What about platforms like linux or windows? What types do they use to report these stats?
64-bit integers. Every C++ compiler Boost tests run on, even really old ones like VC++ 6.0 and GCC2.95, have a 64-bit integral type. Mostly long long, but sometimes long or _int64. The C and C++ standards committees are in process of standardizing long long. --Beman
Beman Dawes wrote:
"Sohail Somani"
wrote in message news:1C1EBEF8DBACDC439D038EA051674EC709C600@xbox.financialcad.com... -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of me22 Sent: Monday, September 12, 2005 4:36 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [BULK] Re: [BULK] [filesystem] function todetermineavailable space
On 12/09/05, Sohail Somani
wrote: What about using a type that guarantees a certain amount instead of just "max" (which may vary)? Or equivalently, are we
guaranteed that
uintmax_t can hold, say one TB, on any platform that boost supports?
Even 1 TB isn't really safe. I know a number of people with more total storage than that.
How about a double? The imprecision shouldn't be a worry -- if you're beyond the range of a double's precision for free space then being off by even a few MB it doesn't matter and doubles are perfectly precise for small integral numbers. ( on x86 linux it seems my 64-bit doubles have 53 bits of mantissa meaning they're perfectly precise for anything less than 8192 TeraBytes. I don't know what the standard specifes though, and my 32-bit floats are only perfectly precise for under 16 MB. That being said, even the 32-bit float has a max of over 3e26 TB, so just saying the precision of the number returned is dependant on the precision of your platform's double would get around that, assuming of course we can assure that any rounding is done on the safe side. )
Also, the implementation could work internally in whatever it wants to keep perfect precision and just feed out a double at the end.
Great idea. I'm ok with this. What about platforms like linux or windows? What types do they use to report these stats?
64-bit integers. Every C++ compiler Boost tests run on, even really old ones like VC++ 6.0 and GCC2.95, have a 64-bit integral type. Mostly long long, but sometimes long or _int64. The C and C++ standards committees are in process of standardizing long long.
Please forgive me for sticking my nose in here, but I believe the SCSI standard provides for data access instructions that contain 48 bit block addresses. Each block is 512 bytes for open systems, which is 9 bits, so you need 57 bits to give a byte count for a single logical device. 64 bit integers are the way to go. - Rush
participants (3)
-
Beman Dawes
-
Rush Manbert
-
Sohail Somani